mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-13 15:47:28 +00:00
test: spell escaped html output
This commit is contained in:
@@ -248,22 +248,17 @@ describe("toSanitizedMarkdownHtml", () => {
|
||||
describe("HTML escaping", () => {
|
||||
it("escapes HTML tags as text", () => {
|
||||
const html = toSanitizedMarkdownHtml("<div>**bold**</div>");
|
||||
expect(html).toContain("<div>");
|
||||
expect(html).not.toContain("<div>");
|
||||
// Inner markdown should NOT be rendered since it's inside escaped HTML
|
||||
expect(html).toContain("**bold**");
|
||||
expect(html).toBe("<div>**bold**</div>\n");
|
||||
});
|
||||
|
||||
it("strips script tags", () => {
|
||||
const html = toSanitizedMarkdownHtml("<script>alert(1)</script>");
|
||||
expect(html).not.toContain("<script");
|
||||
expect(html).toContain("<script>");
|
||||
expect(html).toBe("<script>alert(1)</script>\n");
|
||||
});
|
||||
|
||||
it("escapes inline HTML tags", () => {
|
||||
const html = toSanitizedMarkdownHtml("Check <b>this</b> out");
|
||||
expect(html).toContain("<b>");
|
||||
expect(html).not.toContain("<b>");
|
||||
expect(html).toBe("<p>Check <b>this</b> out</p>\n");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user