import { cn } from './cn' describe('cn', () => { it('should merge Tailwind classes correctly', () => { const result = cn('bg-red-500', 'bg-blue-500') expect(result).toBe('bg-blue-500') // Tailwind Merge prioritizes the last class }) it('should handle conditional classes with clsx', () => { const result = cn('text-lg', false && 'text-sm', 'font-bold') expect(result).toBe('text-lg font-bold') // 'text-sm' is not included }) it('should handle empty inputs gracefully', () => { const result = cn() expect(result).toBe('') // No input returns an empty string }) it('should merge duplicate classes correctly', () => { const result = cn('p-4', 'p-4', 'm-2') expect(result).toBe('p-4 m-2') // Removes duplicates }) it('should merge complex combinations of classes', () => { const result = cn( 'hover:bg-red-500', 'hover:bg-blue-500', 'active:bg-green-500', ) expect(result).toBe('hover:bg-blue-500 active:bg-green-500') // Last 'hover:' wins }) })