Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

703 B
Raw Blame
import { flattenHtml } from "@/lib/scraper/html";

describe("flattenHtml", () => {
  it("decodes entity-encoded HTML and strips tags", () => {
    const raw =
      "<div class="intro"><p>Hello & welcome</p></div>";
    expect(flattenHtml(raw)).toBe("Hello & welcome");
  });

  it("decodes numeric entities and smart quotes", () => {
    expect(flattenHtml("Anthropic's mission")).toBe("Anthropic's mission");
  });

  it("collapses whitespace", () => {
    expect(flattenHtml("<p>a</p>\n\n<p>b</p>")).toBe(
      "a b",
    );
  });

  it("returns empty string for empty input", () => {
    expect(flattenHtml("")).toBe("");
  });
});