Skip to content

Instantly share code, notes, and snippets.

@johnatandias
Created October 20, 2020 15:26
Show Gist options
  • Save johnatandias/008054291b2f208d25595307e1111be2 to your computer and use it in GitHub Desktop.
Save johnatandias/008054291b2f208d25595307e1111be2 to your computer and use it in GitHub Desktop.
Advance Timers By Time
describe('description', () => {
beforeEach(() => {
jest.useFakeTimers();
});
afterEach(() => {
jest.runOnlyPendingTimers();
jest.useRealTimers();
});
it('after 10 seconds the resend token button should be displayed', async () => {
const { getByTestId } = render(<Component />);
jest.advanceTimersByTime(10 * 1000);
expect(getByTestId('resend_button')).toBeDefined();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment