Created
October 20, 2020 15:26
-
-
Save johnatandias/008054291b2f208d25595307e1111be2 to your computer and use it in GitHub Desktop.
Advance Timers By Time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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