]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Stop creating sinon sandbox early
authorPierre Ossman <ossman@cendio.se>
Mon, 5 Aug 2024 13:44:07 +0000 (15:44 +0200)
committerPierre Ossman <ossman@cendio.se>
Mon, 5 Aug 2024 13:45:41 +0000 (15:45 +0200)
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

index df8227aef70aa6d7ad930ffde847509ce9f773a2..11d09309290cf62e5c8f4814032c29af1d4be863 100644 (file)
@@ -182,16 +182,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 () {