Skip to content

Commit

Permalink
fix: unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
remcolakens committed Feb 9, 2025
1 parent e8c4f3b commit 2ed895d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/lib/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ describe('cn utility', () => {
expect(cn('flex', 'items-center')).toBe('flex items-center');

// Test with conditional classes
const isVisible = true;
const isInvisible = false;
expect(
cn('flex', isVisible ? 'visible' : '', isInvisible ? 'invisible' : ''),
).toBe('flex visible');
const isOpen = true;
expect(cn('flex', isOpen && 'visible')).toBe('flex visible');

// Test with Tailwind conflicts (should merge properly)
expect(cn('px-2 py-1', 'px-4')).toBe('py-1 px-4');
expect(cn('text-red-500', 'text-blue-500')).toBe('text-blue-500');

// Test with undefined/null values
expect(cn('flex', undefined, null, 'gap-2')).toBe('flex gap-2');
Expand Down

0 comments on commit 2ed895d

Please sign in to comment.