Command
jest.useFakeTimers()Explanation
Fake timers allow you to control time in tests, useful for testing timeouts and intervals.
Examples
Enable fake timers
jest.useFakeTimers()Advance time by 1 second
jest.advanceTimersByTime(1000)Run all pending timers
jest.runAllTimers()