import { createJob } from "@shared/testing/factories";
import { describe, expect, it } from "vitest";
import { buildDuplicateDismissHints } from "./job-dedup";

describe("buildDuplicateDismissHints", () => {
  it("flags open jobs that match a skipped posting", () => {
    const jobs = [
      createJob({
        id: "skipped-1",
        employer: "Acme",
        title: "SDET",
        status: "skipped",
      }),
      createJob({
        id: "open-1",
        employer: "Acme Inc.",
        title: "SDET (Remote)",
        status: "discovered",
      }),
      createJob({
        id: "open-2",
        employer: "Contoso",
        title: "QA Engineer",
        status: "discovered",
      }),
    ];

    const hints = buildDuplicateDismissHints(jobs);
    expect(hints.get("open-1")).toBe("skipped");
    expect(hints.has("open-2")).toBe(false);
  });
});
