From b77897b78cbd54f202385eceb719dd5d41bc4fc0 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Sun, 8 Nov 2026 06:47:17 -0500 Subject: [PATCH] Apply suggested fix to web/tests/recordingsAPI.spec.js from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- web/tests/recordingsAPI.spec.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/web/tests/recordingsAPI.spec.js b/web/tests/recordingsAPI.spec.js index 1eb57ebe1..ea77fabc1 100644 --- a/web/tests/recordingsAPI.spec.js +++ b/web/tests/recordingsAPI.spec.js @@ -339,12 +339,23 @@ describe('recordingsAPI', () => { describe('archive batch deletion outcomes', () => { const { useMutation, useQueryClient } = require('../js/query-client.ts'); + let previousWindow; + let hadWindow; beforeEach(() => { jest.clearAllMocks(); fetchJSON.mockReset(); + hadWindow = Object.prototype.hasOwnProperty.call(global, 'window'); + previousWindow = global.window; global.window = {}; }); - afterEach(() => { jest.restoreAllMocks(); delete global.window; }); + afterEach(() => { + jest.restoreAllMocks(); + if (hadWindow) { + global.window = previousWindow; + } else { + delete global.window; + } + }); test('mutation waits for the durable job outcome before resolving and refreshing', async () => { const invalidateQueries = jest.fn();