summaryrefslogtreecommitdiff
path: root/src/lib/utils.test.ts
diff options
context:
space:
mode:
authorBertrand Yuan <noreply@bertyuan.com>2026-03-26 00:02:16 +0800
committerBertrand Yuan <noreply@bertyuan.com>2026-03-26 00:02:16 +0800
commit8a6a6712e7554f110b5ef951f270d88fd010e040 (patch)
tree12cb86b1ede55e15600ef7f139ef7ec91b9fa8a1 /src/lib/utils.test.ts
parentf7a02fe0e112cf108fc5f22872f1efc077e99fe8 (diff)
add more tests
Diffstat (limited to 'src/lib/utils.test.ts')
-rw-r--r--src/lib/utils.test.ts21
1 files changed, 21 insertions, 0 deletions
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');
+ });
+});
+