From 1ad0f7b01409b0433b39f6f5f651adb7dfc7b4a4 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 5 Aug 2024 15:44:07 +0200 Subject: [PATCH] Stop creating sinon sandbox early sinon might not be loaded at this point, which can cause tests to fail. We could create the sandbox in one of the hooks instead, but let's remove the sandbox completely to stay consistent with our other tests. --- tests/test.webutil.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test.webutil.js b/tests/test.webutil.js index 7e08cb48f..9151a0603 100644 --- a/tests/test.webutil.js +++ b/tests/test.webutil.js @@ -180,16 +180,15 @@ describe('WebUtil', function () { window.chrome = chrome; }); - const csSandbox = sinon.createSandbox(); - beforeEach(function () { settings = {}; - csSandbox.spy(window.chrome.storage.sync, 'set'); - csSandbox.spy(window.chrome.storage.sync, 'remove'); + sinon.spy(window.chrome.storage.sync, 'set'); + sinon.spy(window.chrome.storage.sync, 'remove'); return WebUtil.initSettings(); }); afterEach(function () { - csSandbox.restore(); + window.chrome.storage.sync.set.restore(); + window.chrome.storage.sync.remove.restore(); }); describe('writeSetting', function () {