Skip to content

Commit

Permalink
Stop creating sinon sandbox early
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
CendioOssman authored and masad-frost committed Sep 12, 2024
1 parent 9165290 commit 1ad0f7b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tests/test.webutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit 1ad0f7b

Please sign in to comment.