codingdebuggingpractice
Make time-dependent tests deterministic
Anonymous
Pass a clock into code that checks deadlines or time windows, then use a fixed clock in tests. Advancing that clock lets tests cover boundary cases without sleeping or depending on when the test happens to run. Keep the real clock as the production default.
0