diff --git a/test/javascript_components.js b/test/javascript_components.js index a917572..dd9146a 100644 --- a/test/javascript_components.js +++ b/test/javascript_components.js @@ -38,7 +38,7 @@ let _js = ""; assert.ok(j); }); - it("should load DOMPurify", async function() { + it("should load DOMPurify and sanitize", async function() { const page = await browser.newPage(); await page.goto(indexHTMLURL); @@ -48,10 +48,10 @@ let _js = ""; assert.ok(dp, "DOMPurify should be loaded on the page."); const sanitizedOutput = await page.evaluate(() => { - const dirty = ''; - return DOMPurify.sanitize(dirty); + const dirty = ""; + return window.DOMPurify.sanitize(dirty); }); - assert.strictEqual(sanitizedOutput, '', "DOMPurify should sanitize malicious scripts correctly."); + assert.strictEqual(sanitizedOutput, "", "DOMPurify should sanitize malicious scripts correctly."); }); // TODO: implement this test! _js is always empty