diff --git a/modules/renderer/map.js b/modules/renderer/map.js index 0e5a7127cb..a288aef41b 100644 --- a/modules/renderer/map.js +++ b/modules/renderer/map.js @@ -653,6 +653,9 @@ export function rendererMap(context) { function redraw(difference, extent) { + // in unit tests, we need to abort if the test has already completed + if (typeof window === 'undefined') return; + if (surface.empty() || !_redrawEnabled) return; // If we are in the middle of a zoom/pan, we can't do differenced redraws. diff --git a/modules/util/session_mutex.js b/modules/util/session_mutex.js index 99fdc94d93..42b61edcad 100644 --- a/modules/util/session_mutex.js +++ b/modules/util/session_mutex.js @@ -8,6 +8,9 @@ export function utilSessionMutex(name) { var intervalID; function renew() { + // in unit tests, we need to abort if the test has already completed + if (typeof window === 'undefined') return; + var expires = new Date(); expires.setSeconds(expires.getSeconds() + 5); document.cookie = name + '=1; expires=' + expires.toUTCString() + '; sameSite=strict'; diff --git a/test/spec/services/panoramax.js b/test/spec/services/panoramax.js index e418509046..c695754518 100644 --- a/test/spec/services/panoramax.js +++ b/test/spec/services/panoramax.js @@ -21,6 +21,9 @@ describe('iD.servicePanoramax', function() { panoramax = iD.services.panoramax; panoramax.reset(); fetchMock.reset(); + + // never resolve + fetchMock.mock(/api\.panoramax\.xyz/, new Promise(() => {})); }); afterEach(function() {