Files
notifications-admin/tests/javascripts
Ben Thorner 2d98bf6c5d Restore all mocks after each test
This is easier than re-assigning the mock functions manually, as
we're reusing Jest's in-built behaviour. Because all the mocks
are restored, we need to move the ones we had in the beforeAll
block into the beforeEach block.

Note: "require('./support/teardown.js')" also resets all Jest
mocks, but "require" only runs once, so we can't use it in a
beforeEach block [1]. We could do a "jest.resetModules()" to fix
that, which seems worse on the whole. I think there's a broader
discussion here about whether we could / should have a global
reset of Jest mocks after each test - I quickly tried this and
it causes some existing tests to fail :-|.

[1]: https://stackoverflow.com/questions/48989643/how-to-reset-module-imported-between-tests
2021-06-10 14:43:30 +01:00
..
2020-09-15 17:07:01 +01:00