import assert from "node:assert/strict"; import { describe, it } from "node:test"; import { normalizeNoteBody } from "../../src/components/rich-text/normalize-body"; import { sanitizeRichTextHtml } from "../../src/components/rich-text/sanitize"; import { toggleTaskItemInHtml } from "../../src/components/rich-text/toggle-checklist"; describe("normalizeNoteBody", () => { it("wraps plain text paragraphs in HTML", () => { const html = normalizeNoteBody("Hello\n\nWorld"); assert.match(html, /
Hello<\/p>/); assert.match(html, /
World<\/p>/); }); it("preserves existing HTML", () => { const input = "
Bold
"; assert.equal(normalizeNoteBody(input), input); }); }); describe("sanitizeRichTextHtml", () => { it("strips script tags", () => { const safe = sanitizeRichTextHtml('Hi
'); assert.doesNotMatch(safe, /