Skip to content

Instantly share code, notes, and snippets.

@lotif
Created June 16, 2017 21:50
Show Gist options
  • Save lotif/c2dc0ead6ad9003ed3fc9ebe94a11e07 to your computer and use it in GitHub Desktop.
Save lotif/c2dc0ead6ad9003ed3fc9ebe94a11e07 to your computer and use it in GitHub Desktop.
flushAllPromises
/* 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