import { describe, it, expect } from 'vitest'
import { cn } from '../../lib/utils.js'

describe('cn', () => {
  it('merges multiple class names into a single string', () => {
    expect(cn('foo', 'bar')).toBe('foo bar')
    expect(cn('a', 'b', 'c')).toBe('a b c')
  })

  it('omits falsy conditional classes', () => {
    expect(cn('base', false && 'hidden', 'visible')).toBe('base visible')
    expect(cn('x', undefined, null, 0, 'y')).toBe('x y')
  })

  it('resolves conflicting Tailwind utilities in favor of the last one', () => {
    expect(cn('p-4', 'p-2')).toBe('p-2')
    expect(cn('text-sm', 'text-lg')).toBe('text-lg')
  })
})
