Created
June 16, 2017 21:50
-
-
Save lotif/c2dc0ead6ad9003ed3fc9ebe94a11e07 to your computer and use it in GitHub Desktop.
flushAllPromises
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
/* Async function that will finish execution after all promises have been finished | |
* Usage: | |
* it('...', async () =. { | |
* // mount component | |
* // execute actions | |
* await flushAllPromises(); | |
* // execute assertions for async actions | |
* }); | |
*/ | |
export function flushAllPromises() { | |
return new Promise(resolve => setImmediate(resolve)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment