I am trying to write tests for my javascript game using Jest for the first time. When I run the tests, jest is saying:
FAIL ./scripts.test.js ● Test suite failed to run
TypeError: Cannot set property 'onclick' of undefined
87 |
88 | // close button for modal
> 89 | span.onclick = function() {
| ^
90 | modal.style.display = "none";
91 | }
92 |
I don't understand why it going to the span.onClick function, when I am only exporting addTwo function for testing. I wrote a simple test in scripts.test.js file, which is what I want jest to use for the test?
Aucun commentaire:
Enregistrer un commentaire