Click in order · JavaScript and TypeScript course · Module 11: Testing with Jest

Fake Timers Syntax

Arrange the elements of fake timers usage in a test:

Items to click

  • expect(callback).toHaveBeenCalled();
  • jest.useRealTimers();
  • jest.useFakeTimers();
  • startCountdown(callback);
  • jest.advanceTimersByTime(30000);

You can check the correct answer by solving this task in the CodeWorlds game.