From 55ed0c084b2eae75b9ae5d4900243c679157dd21 Mon Sep 17 00:00:00 2001 From: tmdeveloper007 Date: Sun, 28 Jun 2026 06:43:56 +0000 Subject: [PATCH] test: add unit tests for sanitize.ts --- test/sanitize.test.ts | 134 ++++++++++++++++++++++-------------------- 1 file changed, 70 insertions(+), 64 deletions(-) diff --git a/test/sanitize.test.ts b/test/sanitize.test.ts index 83eda3945..ac00df51f 100644 --- a/test/sanitize.test.ts +++ b/test/sanitize.test.ts @@ -2,103 +2,109 @@ import { describe, it, expect } from "vitest"; import { stripHtml, validateTextInput } from "../src/lib/sanitize"; describe("stripHtml", () => { - it("removes HTML tags", () => { - expect(stripHtml("Hello")).toBe("Hello"); + it("returns plain text unchanged", () => { + expect(stripHtml("hello world")).toBe("hello world"); }); - it("removes nested HTML tags", () => { - expect(stripHtml("

Test

")).toBe("Test"); + it("strips simple tags", () => { + expect(stripHtml("bold")).toBe("bold"); }); - it("decodes HTML entities", () => { - expect(stripHtml("<script>")).toBe("