Question · Cours JavaScript et TypeScript · Module 11: Tests avec Jest
Le matcher toThrow
Comment utiliser correctement le matcher toThrow dans Jest ?
Réponses possibles
- toThrow(expect(myFunction))
- expect(toThrow(myFunction))
- expect(myFunction()).toThrow()
- expect(() => myFunction()).toThrow()
Tu vérifieras la bonne réponse en résolvant cet exercice dans le jeu CodeWorlds.