import { describe, expect, it } from "vitest";
import { parseGeneratedCaseProvenance } from "./generation-provenance";

const fixture = {
  kind: "generated",
  generatorId: "regex-tools-ast-cases",
  generatorVersion: "1",
  seed: "release-seed",
  candidateId: "generated-12345678-1",
  intendedOutcome: "match",
} as const;

describe("generated-case provenance", () => {
  it("round-trips the exact bounded generator identity and seed", () => {
    expect(parseGeneratedCaseProvenance(fixture)).toEqual(fixture);
  });

  it.each([
    [{ ...fixture, kind: "manual" }, "kind"],
    [{ ...fixture, generatorId: "other" }, "generatorId"],
    [{ ...fixture, generatorVersion: "2" }, "generatorVersion"],
    [{ ...fixture, seed: "" }, "seed"],
    [{ ...fixture, candidateId: "" }, "candidateId"],
    [{ ...fixture, intendedOutcome: "maybe" }, "intendedOutcome"],
    [{ ...fixture, unexpected: true }, "unsupported entries"],
  ])("rejects unsupported imported provenance %#", (value, message) => {
    expect(() => parseGeneratedCaseProvenance(value)).toThrow(message);
  });
});
