import { cn } from '@/lib/utils/cn'

describe('cn utility function', () => {
  it('should merge class names correctly', () => {
    const result = cn('text-red-500', 'bg-blue-500', 'p-4')
    expect(result).toBe('text-red-500 bg-blue-500 p-4')
  })

  it('should handle conditional classes', () => {
    const isActive = true
    const result = cn('base-class', isActive && 'active-class', 'always-class')
    expect(result).toBe('base-class active-class always-class')
  })

  it('should handle false conditional classes', () => {
    const isActive = false
    const result = cn('base-class', isActive && 'active-class', 'always-class')
    expect(result).toBe('base-class always-class')
  })

  it('should handle arrays of classes', () => {
    const result = cn(['class1', 'class2'], 'class3')
    expect(result).toBe('class1 class2 class3')
  })

  it('should handle objects with boolean values', () => {
    const result = cn({
      'class1': true,
      'class2': false,
      'class3': true
    })
    expect(result).toBe('class1 class3')
  })

  it('should handle empty inputs', () => {
    const result = cn()
    expect(result).toBe('')
  })

  it('should handle mixed inputs', () => {
    const result = cn('base', ['array1', 'array2'], { 'obj1': true, 'obj2': false }, 'string')
    expect(result).toBe('base array1 array2 obj1 string')
  })
}) 