How to mock the Date to keep date-based unit tests predictable
When unit testing functions that use the Date.now() function, you’ll need to lock down the value it returns – otherwise, your unit tests will only ever run successfully on the day (or even [...]