Created
December 1, 2023 03:33
-
-
Save jamesasu/a7e7e856383797f07d44ecdc67d9c8c5 to your computer and use it in GitHub Desktop.
Need to sleep/wait in a jest test?
This file contains hidden or 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
test('Wait for 1 second', async () => { | |
runBeforeTheDelay(); | |
await new Promise((r) => setTimeout(r, 1000)); | |
runAfterTheDelay(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment