groundhog-day
groundhog-day is a wrapper around Date.now()
with real and fake implementations. The real implementation returns the current time, the fake implementation returns a fixed time (defaults to Groundhog day). Use the real implementation in your production code, but inject the fake implementation in tests for predictable results.
TL;DR
1. Use a fake clock in tests
const Server = const request = const clock = const assert =
2. Use a real clock in production
const Server = const clock = clockstart { if err process console}
Fixing Time
You can configure the fixed time returned by the fake clock in any of the following ways:
By specifying the number of milliseconds
const clock = clock
By specifying a date instance
const clock = clock
By specifying a date string
const clock = clock