From f4ab8776efbaa6adb2bf2465cec0a80ed14f8e94 Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Wed, 12 May 2021 17:42:28 +0100 Subject: [PATCH] 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. --- tests/javascripts/registerSecurityKey.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/javascripts/registerSecurityKey.test.js b/tests/javascripts/registerSecurityKey.test.js index 4831fdc26..94e756361 100644 --- a/tests/javascripts/registerSecurityKey.test.js +++ b/tests/javascripts/registerSecurityKey.test.js @@ -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: () => {} }