import { describe, it, expect } from "vitest";
import { useCaseNameFromFile } from "./_usecase-name.js";

describe("useCaseNameFromFile", () => {
  it("converts kebab-case slug to camelCase", () => {
    expect(useCaseNameFromFile("/repo/packages/auth/src/application/use-cases/sign-in.use-case.ts")).toBe("signIn");
    expect(useCaseNameFromFile("/repo/packages/auth/src/application/use-cases/sign-up.use-case.ts")).toBe("signUp");
    expect(useCaseNameFromFile("/repo/packages/blog/src/application/use-cases/get-article-by-slug.use-case.ts")).toBe("getArticleBySlug");
  });

  it("handles single-word slugs", () => {
    expect(useCaseNameFromFile("/repo/packages/x/src/application/use-cases/login.use-case.ts")).toBe("login");
  });

  it("returns null for non-use-case files", () => {
    expect(useCaseNameFromFile("/repo/packages/auth/src/index.ts")).toBeNull();
    expect(useCaseNameFromFile("/repo/packages/auth/src/feature.manifest.ts")).toBeNull();
  });
});
