TIL... About jest.resetAllMocks()
This iteration I was writing an Integration style test in Jest. I needed to verify that certain mocks weren’t called in the Unhappy Path of the test. But because the Happy Path tests called them, they had ‘old’ call data in the mock.
After a bit of research I found my answer: tell Jest to reset the mocks. All you have to do is add:
1 | describe('when *your test step*'()=>{ |
And as the name implies Jest dumps the ‘old’ call data. And now I can verify my Unhappy Paths.