diff --git a/js/test/AttachmentViewer.js b/js/test/AttachmentViewer.js index 4ee5df85..37d9a873 100644 --- a/js/test/AttachmentViewer.js +++ b/js/test/AttachmentViewer.js @@ -14,7 +14,7 @@ describe('AttachmentViewer', function () { 'string', // eslint-disable-next-line complexity function (mimeType, rawdata, filename, prefix, postfix) { - let clean = jsdom(), + let clean = globalThis.cleanup(), data = 'data:' + mimeType + ';base64,' + common.btoa(rawdata), mimePrefix = mimeType.substring(0, 6), previewSupported = ( @@ -133,7 +133,7 @@ describe('AttachmentViewer', function () { it( 'sanitizes file names in attachments', function() { - const clean = jsdom(); + const clean = globalThis.cleanup(); $('body').html( '
' + '' + diff --git a/js/test/Check.js b/js/test/Check.js index 79fdfc26..011db36a 100644 --- a/js/test/Check.js +++ b/js/test/Check.js @@ -12,7 +12,7 @@ describe('Check', function () { jsc.elements(['Bot', 'bot']), 'string', function (prefix, botBit, suffix) { - const clean = jsdom( + const clean = globalThis.cleanup( '' + '', { 'userAgent': prefix + botBit + suffix @@ -36,7 +36,7 @@ describe('Check', function () { function (secureProtocol, localhost, domain, tld) { const isDomain = localhost === '', isSecureContext = secureProtocol || !isDomain || tld.length > 0, - clean = jsdom( + clean = globalThis.cleanup( '' + '' + '', @@ -63,7 +63,7 @@ describe('Check', function () { 'bool', jsc.nearray(common.jscA2zString()), function (secureProtocol, domain) { - const clean = jsdom( + const clean = globalThis.cleanup( '' + '', { diff --git a/js/test/CopyToClipboard.js b/js/test/CopyToClipboard.js index 692b700c..e91ad50c 100644 --- a/js/test/CopyToClipboard.js +++ b/js/test/CopyToClipboard.js @@ -9,7 +9,7 @@ describe('CopyToClipboard', function() { common.jscFormats(), 'nestring', async function (format, text) { - var clean = jsdom(); + var clean = globalThis.cleanup(); common.enableClipboard(); $('body').html( @@ -46,7 +46,7 @@ describe('CopyToClipboard', function() { common.jscFormats(), 'nestring', async function (format, text) { - var clean = jsdom(); + var clean = globalThis.cleanup(); common.enableClipboard(); $('body').html( @@ -80,7 +80,7 @@ describe('CopyToClipboard', function() { jsc.property('Copy link to clipboard', 'nestring', async function (text) { - var clean = jsdom(); + var clean = globalThis.cleanup(); common.enableClipboard(); $('body').html(''); @@ -103,7 +103,7 @@ describe('CopyToClipboard', function() { jsc.property('Show hint', 'nestring', function (text) { - var clean = jsdom(); + var clean = globalThis.cleanup(); $('body').html(''); @@ -121,7 +121,7 @@ describe('CopyToClipboard', function() { jsc.property('Hide hint', 'nestring', function (text) { - var clean = jsdom(); + var clean = globalThis.cleanup(); $('body').html('' + text + ''); @@ -136,4 +136,4 @@ describe('CopyToClipboard', function() { } ); }); -}); \ No newline at end of file +}); diff --git a/js/test/CryptTool.js b/js/test/CryptTool.js index 4db3ef90..f217b426 100644 --- a/js/test/CryptTool.js +++ b/js/test/CryptTool.js @@ -15,7 +15,7 @@ describe('CryptTool', function () { 'string', 'string', async function (key, password, message) { - const clean = jsdom(); + const clean = globalThis.cleanup(); // ensure zlib is getting loaded PrivateBin.Controller.initZ(); Object.defineProperty(window, 'crypto', { @@ -42,7 +42,7 @@ describe('CryptTool', function () { it('does not truncate messages', async function () { const message = fs.readFileSync('test/compression-sample.txt', 'ascii').trim(), - clean = jsdom(); + clean = globalThis.cleanup(); Object.defineProperty(window, 'crypto', { value: new WebCrypto(), writeable: false @@ -91,7 +91,7 @@ isWhile : interp (while expr sBody) (MemElem mem) = ======================== ( 1 / 1 ) conseq_or_bottom inv (interp (nth_iterate sBody n) (MemElem mem)) `; - const clean = jsdom(); + const clean = globalThis.cleanup(); // ensure zlib is getting loaded PrivateBin.Controller.initZ(); Object.defineProperty(window, 'crypto', { @@ -123,7 +123,7 @@ conseq_or_bottom inv (interp (nth_iterate sBody n) (MemElem mem)) jsc.assert(jsc.forall( 'integer', function(counter) { - const clean = jsdom(); + const clean = globalThis.cleanup(); Object.defineProperty(window, 'crypto', { value: new WebCrypto(), writeable: false diff --git a/js/test/DiscussionViewer.js b/js/test/DiscussionViewer.js index 0203ddd5..a44b7cac 100644 --- a/js/test/DiscussionViewer.js +++ b/js/test/DiscussionViewer.js @@ -26,7 +26,7 @@ describe('DiscussionViewer', function () { jsc.elements(['loading', 'danger', 'other']), 'nestring', function (comments, commentKey, fadeOut, nickname, message, alertType, alert) { - var clean = jsdom(), + var clean = globalThis.cleanup(), results = []; $('body').html( '