From 8a6a6712e7554f110b5ef951f270d88fd010e040 Mon Sep 17 00:00:00 2001 From: Bertrand Yuan Date: Thu, 26 Mar 2026 00:02:16 +0800 Subject: add more tests --- src/lib/utils.test.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/lib/utils.test.ts (limited to 'src/lib/utils.test.ts') diff --git a/src/lib/utils.test.ts b/src/lib/utils.test.ts new file mode 100644 index 0000000..9a61d41 --- /dev/null +++ b/src/lib/utils.test.ts @@ -0,0 +1,21 @@ +import { describe, expect, test } from 'vitest'; +import { cn } from './utils'; + +describe('cn', () => { + test('merges class names and resolves tailwind conflicts', () => { + expect(cn('px-2', 'px-4')).toBe('px-4'); + }); + + test('handles conditional and falsy inputs', () => { + expect(cn('text-sm', false && 'hidden', undefined, 'font-medium')).toBe( + 'text-sm font-medium', + ); + }); + + test('supports object and array style class inputs', () => { + expect( + cn(['inline-flex', ['items-center']], { 'cursor-pointer': true }), + ).toBe('inline-flex items-center cursor-pointer'); + }); +}); + -- cgit v1.2.3