import { describe, expect, it } from "vitest";
import { findUnmatchedRequestedFiles, isFullRunSelection } from "./selection.mjs";

describe("runner selection", () => {
  it("finds unmatched requested files", () => {
    const unmatched = findUnmatchedRequestedFiles(
      [{ name: "api" }],
      ["int"],
      [],
      ["tests/a.int.testkit.ts", "tests/missing.int.testkit.ts"],
      () => [{ files: ["tests/a.int.testkit.ts"] }],
      (value) => value
    );

    expect(unmatched).toEqual(["tests/missing.int.testkit.ts"]);
  });

  it("detects a full run selection", () => {
    expect(isFullRunSelection(["all"], [], [], null, null)).toBe(true);
    expect(isFullRunSelection(["all"], [{ raw: "auth" }], [], null, null)).toBe(false);
    expect(isFullRunSelection(["all"], [], ["a"], null, null)).toBe(false);
    expect(isFullRunSelection(["int"], [], [], null, null)).toBe(false);
  });
});
