Skip to content

Commit a5c5458

Browse files
committed
update test
1 parent 24dab1d commit a5c5458

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/utils.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,15 @@ describeMatrix("utils", (t, { it, describe, expect }) => {
4343
});
4444

4545
it("escapes special characters in HTML body", async () => {
46-
const malicious = 'https://example.com/"><script>alert(1)</script>';
46+
const malicious =
47+
'https://example.com/"><script>alert(1)</script>&foo=bar';
4748
t.app.use(() => redirect(malicious));
4849
const result = await t.fetch("/");
4950
expect(result.headers.get("location")).toBe(malicious);
5051
const body = await result.text();
51-
expect(body).not.toContain("<script>");
52-
expect(body).toContain("&lt;script&gt;");
53-
expect(body).toContain("&quot;");
52+
expect(body).toBe(
53+
`<html><head><meta http-equiv="refresh" content="0; url=https://example.com/&quot;&gt;&lt;script&gt;alert(1)&lt;/script&gt;&amp;foo=bar" /></head></html>`,
54+
);
5455
});
5556
});
5657

0 commit comments

Comments
 (0)