import { describe, it, expect } from "vitest"; import { cn } from "./cn"; describe("cn utility", () => { it("should merge class names", () => { const result = cn("foo", "bar"); expect(result).toBe("foo bar"); }); it("should handle conditional classes", () => { const result = cn("base", true && "included", false && "excluded"); expect(result).toBe("base included"); }); it("should merge tailwind classes correctly", () => { const result = cn("px-2 py-1", "px-4"); expect(result).toBe("py-1 px-4"); }); it("should handle arrays of classes", () => { const result = cn(["foo", "bar"], "baz"); expect(result).toBe("foo bar baz"); }); it("should handle undefined and null values", () => { const result = cn("foo", undefined, null, "bar"); expect(result).toBe("foo bar"); }); it("should handle object syntax", () => { const result = cn({ foo: true, bar: false, baz: true }); expect(result).toBe("foo baz"); }); it("should handle empty input", () => { const result = cn(); expect(result).toBe(""); }); it("should deduplicate conflicting tailwind utilities", () => { const result = cn("text-red-500", "text-blue-500"); expect(result).toBe("text-blue-500"); }); });