import { describe, expect, it } from "bun:test"; import { htmlToText } from "../server/lib/formatters/helpers"; describe("htmlToText", () => { it("strips an HTML table bot comment into clean text", () => { const html = "Deploying webhooker with Cloudflare Pages.
Latest commit:526e6c4
Status:āœ… Deploy successful!
Preview URL:preview
"; const out = htmlToText(html); expect(out).not.toContain(""); expect(out).not.toContain("
"); expect(out).not.toContain(" { const md = "**bold** and `code` and [link](https://example.com)"; expect(htmlToText(md)).toBe(md); }); it("converts
to a newline", () => { expect(htmlToText("line one
line two")).toBe("line one\nline two"); }); it("converts
  • to a bullet", () => { expect(htmlToText("
    • first
    • second
    ")).toBe("• first\n• second"); }); it("decodes entities", () => { expect(htmlToText("a & b <tag> "q" 'apos'")).toBe( "a & b \"q\" 'apos'", ); }); it("returns an empty string for empty input", () => { expect(htmlToText("")).toBe(""); }); });