- Replace setState-in-effect with state-based tracking (AdminLayout, EditCategoryModal) - Convert inline SortIcon component to getSortIcon function (TreeTableView) - Remove unused catch parameters (CreateCategoryModal, EditCategoryModal) - Replace `any` types with proper types (SessionFilters, AdminCategoriesPage, SessionHistoryPage) - Fix unused destructuring variable (StepRatingModal) - Fix constant binary expression in test (utils.test.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30 lines
744 B
TypeScript
30 lines
744 B
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { cn } from './utils'
|
|
|
|
describe('cn', () => {
|
|
it('merges class names', () => {
|
|
expect(cn('foo', 'bar')).toBe('foo bar')
|
|
})
|
|
|
|
it('handles conditional classes', () => {
|
|
const isHidden = false
|
|
expect(cn('base', isHidden && 'hidden', 'visible')).toBe('base visible')
|
|
})
|
|
|
|
it('deduplicates tailwind classes', () => {
|
|
expect(cn('p-4', 'p-2')).toBe('p-2')
|
|
})
|
|
|
|
it('handles undefined and null', () => {
|
|
expect(cn('foo', undefined, null, 'bar')).toBe('foo bar')
|
|
})
|
|
|
|
it('handles empty inputs', () => {
|
|
expect(cn()).toBe('')
|
|
})
|
|
|
|
it('merges conflicting tailwind utilities', () => {
|
|
expect(cn('text-red-500', 'text-blue-500')).toBe('text-blue-500')
|
|
})
|
|
})
|