import { describe, expect, test } from "bun:test"; import { renderToStaticMarkup } from "react-dom/server"; import { SearchText } from "./search-text"; describe("search snippet highlights", () => { test("matches literal syntax and all case-insensitive occurrences", () => { const html = renderToStaticMarkup(); expect(html.match(/)).toContain( ">[a.*]", ); }); test("escapes untrusted markup and handles Unicode without cutting surrogate pairs", () => { const html = renderToStaticMarkup( alert("x") 😀'} query="😀" />, ); expect(html.match(/"); expect(html).toContain("<script>"); }); test("empty query does not create empty marks", () => { expect(renderToStaticMarkup()).toBe("test"); }); });