Skip to content

amirelemam/simulateTimeUnitTests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simulate Time in Unit Tests

This project is an example of how to simulate time on an unit test.

Use case

Let's say your system should perform regular backups every day at midnight. In order to test the function that backs up the system, you need to simulate that's midnight when the test run. Here's how to do that!

Instalation

  1. Install dependencies
$ npm install
  1. Run tests
$ npm test

Tutorial

[Medium[(https://amirelemam.medium.com/simulate-time-in-a-unit-test-c2fb86f29254)

License

These files are licensed under the MIT License

About

How to simulate time in a unit test with Jest

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published