import { describe, it, expect } from "vitest";
import { moduleCategories, moduleModelCategory, moduleTestCaseCategories } from "./categories";

describe("moduleCategories", () => {
  it("produces command/query categories with correct patterns", () => {
    const cats = moduleCategories("modules");
    expect(cats).toHaveLength(2);

    const command = cats.find((c) => c.name === "command")!;
    expect(command.sourcePattern).toBe("modules/*/command/*.ts");
    expect(command.docPattern).toBe("modules/*/docs/command/*.md");
    expect(command.exclusions).toEqual([/\.test\.ts$/, /\.generated\.ts$/]);

    const query = cats.find((c) => c.name === "query")!;
    expect(query.sourcePattern).toBe("modules/*/query/*.ts");
    expect(query.docPattern).toBe("modules/*/docs/query/*.md");
  });
});

describe("moduleModelCategory", () => {
  it("produces model category with correct patterns", () => {
    const cat = moduleModelCategory("modules");
    expect(cat.name).toBe("model");
    expect(cat.sourcePattern).toBe("modules/*/db/*.ts");
    expect(cat.docPattern).toBe("modules/*/docs/model/*.md");
  });
});

describe("moduleTestCaseCategories", () => {
  it("produces command and query test case categories", () => {
    const cats = moduleTestCaseCategories("modules");
    expect(cats).toHaveLength(2);
    expect(cats[0].testDir).toBe("command");
    expect(cats[1].testDir).toBe("query");
  });
});
