Skip to content

Commit

Permalink
fix sourcery AI test problem
Browse files Browse the repository at this point in the history
  • Loading branch information
shakeelmohamed committed Apr 21, 2024
1 parent a73c24c commit 773b6f0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/javascript_components.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -48,10 +48,10 @@ let _js = "";
assert.ok(dp, "DOMPurify should be loaded on the page.");

const sanitizedOutput = await page.evaluate(() => {
const dirty = '<img src="x" onerror="alert(1)">';
return DOMPurify.sanitize(dirty);
const dirty = "<img src=\"x\" onerror=\"alert(1)\">";
return window.DOMPurify.sanitize(dirty);
});
assert.strictEqual(sanitizedOutput, '<img src="x">', "DOMPurify should sanitize malicious scripts correctly.");
assert.strictEqual(sanitizedOutput, "<img src=\"x\">", "DOMPurify should sanitize malicious scripts correctly.");
});

// TODO: implement this test! _js is always empty
Expand Down

0 comments on commit 773b6f0

Please sign in to comment.