Question · JavaScript and TypeScript course · Module 11: Testing with Jest

Testing async/await

How do you correctly test an async function in Jest?

Answer options

  • asyncTest('name', () => { myAsyncFn(); })
  • test('name', () => { async myAsyncFn(); })
  • test('name', async () => { await myAsyncFn(); })
  • test('name', () => { myAsyncFn(); })

You can check the correct answer by solving this task in the CodeWorlds game.