From ee6761cf7caa463aa1392227811406608c8d0840 Mon Sep 17 00:00:00 2001 From: xusd320 Date: Fri, 19 Jul 2024 21:32:19 +0800 Subject: [PATCH] test: add sanitise test case --- test/index.spec.mjs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/index.spec.mjs b/test/index.spec.mjs index 1029fd5..2d4eae0 100644 --- a/test/index.spec.mjs +++ b/test/index.spec.mjs @@ -15,6 +15,17 @@ function formatHtml(html) { .replace(/\r\n/g, "\n"); } +test("should sanitise html", (t) => { + const $ = parse( + '
first
Bad body
second
', + ); + + t.is( + $.outerHtml(), + '
first
Bad body
second
', + ); +}); + test("should not change the original html structure", (t) => { const jqueryHtml = fs.readFileSync(path.resolve(__dirname, "jquery.html"), { encoding: "utf8",