These tests will only pass during the third phase of a new moon. Photo by Ramazan Tokay on Unsplash

Mocking the time: Using Timers in Jest

A great Unit Test covers the 3 R’s; Repeatable, Reliable, Resilient. One thing that does not help with achieving the 3 R’s are test cases that only work at a certain time. Jest has a way to mock timers in tests. In this article we’re going to look at how 3 of…

Kris Raven
Geek Culture
Published in
3 min readFeb 3

--

--

Kris Raven
Geek Culture

Quality Engineering Manager | A wholesome mix of QA, Automated Testing, music and philosophy | Enjoys unit tests | Favours integration tests