import { describe, it, expect } from "vitest";
import { resolveModuleDocPath } from "./doc";

describe("resolveModuleDocPath", () => {
  it("resolves command doc path", () => {
    const result = resolveModuleDocPath("command", "CreateOrder", "modules/inventory");
    expect(result).toBe("modules/inventory/docs/command/CreateOrder.md");
  });

  it("resolves feature doc path", () => {
    const result = resolveModuleDocPath("feature", "stock-tracking", "modules/inventory");
    expect(result).toBe("modules/inventory/docs/feature/stock-tracking.md");
  });

  it("resolves model doc path", () => {
    const result = resolveModuleDocPath("model", "StockItem", "modules/inventory");
    expect(result).toBe("modules/inventory/docs/model/StockItem.md");
  });

  it("resolves query doc path", () => {
    const result = resolveModuleDocPath("query", "ConvertQuantity", "modules/inventory");
    expect(result).toBe("modules/inventory/docs/query/ConvertQuantity.md");
  });

  it("throws when name is missing", () => {
    expect(() => resolveModuleDocPath("command", undefined, "modules/inventory")).toThrow(
      "Name is required",
    );
  });
});
