Fix confusing error messages when debugging

Previously a bug in the first test would lead to a 'not implemented'
console error, which isn't the actual problem. This ensures alert()
is just a simple no-op, so we can concentrate on actual errors.
This commit is contained in:
Ben Thorner
2021-05-12 17:42:28 +01:00
parent 9c983b8941
commit f4ab8776ef

View File

@@ -6,6 +6,9 @@ beforeAll(() => {
// you might need to comment this out to debug some failures
jest.spyOn(console, 'error').mockImplementation(() => {})
// ensure window.alert() is implemented to simplify errors
jest.spyOn(window, 'alert').mockImplementation(() => {})
// populate missing values to allow consistent jest.spyOn()
window.fetch = () => {}
window.navigator.credentials = { create: () => {} }