Question · Cours JavaScript et TypeScript · Module 11: Tests avec Jest

Tester async/await

Comment tester correctement une fonction async dans Jest ?

Réponses possibles

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

Tu vérifieras la bonne réponse en résolvant cet exercice dans le jeu CodeWorlds.