import { describe, it, expect } from "vitest";
import { cn, getDifficultyVariant, getDifficultyLabel, capitalize } from "./utils";

describe("cn", () => {
  it("joins multiple class names", () => {
    expect(cn("foo", "bar")).toBe("foo bar");
  });

  it("filters out falsy values", () => {
    expect(cn("foo", undefined, false, "bar")).toBe("foo bar");
  });

  it("returns empty string for no classes", () => {
    expect(cn()).toBe("");
  });
});

describe("getDifficultyVariant", () => {
  it("returns difficulty-easy variant for easy", () => {
    expect(getDifficultyVariant("easy")).toBe("difficulty-easy");
  });

  it("returns difficulty-medium variant for medium", () => {
    expect(getDifficultyVariant("medium")).toBe("difficulty-medium");
  });

  it("returns difficulty-hard variant for hard", () => {
    expect(getDifficultyVariant("hard")).toBe("difficulty-hard");
  });
});

describe("getDifficultyLabel", () => {
  it("returns accessible label for easy", () => {
    expect(getDifficultyLabel("easy")).toBe("Easy difficulty");
  });

  it("returns accessible label for medium", () => {
    expect(getDifficultyLabel("medium")).toBe("Medium difficulty");
  });

  it("returns accessible label for hard", () => {
    expect(getDifficultyLabel("hard")).toBe("Hard difficulty");
  });
});

describe("capitalize", () => {
  it("capitalizes first letter", () => {
    expect(capitalize("hello")).toBe("Hello");
  });

  it("handles already capitalized strings", () => {
    expect(capitalize("Hello")).toBe("Hello");
  });

  it("handles single character", () => {
    expect(capitalize("a")).toBe("A");
  });

  it("handles empty string", () => {
    expect(capitalize("")).toBe("");
  });
});
