mirror of
https://github.com/ahmadk953/tasko.git
synced 2025-05-04 04:33:10 +00:00
Added Basic Darkmode and Fixed Small Bugs
This commit is contained in:
parent
aacca3d141
commit
94fb5c7eb1
42 changed files with 593 additions and 72 deletions
40
__tests__/utils.test.ts
Normal file
40
__tests__/utils.test.ts
Normal file
|
@ -0,0 +1,40 @@
|
|||
import { cn, absoluteUrl } from '@/lib/utils';
|
||||
|
||||
describe('absoluteUrl', () => {
|
||||
const originalEnv = process.env;
|
||||
|
||||
beforeEach(() => {
|
||||
process.env = {
|
||||
...originalEnv,
|
||||
NEXT_PUBLIC_APP_URL: 'https://example.com',
|
||||
};
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
process.env = originalEnv;
|
||||
});
|
||||
|
||||
it('should return the correct absolute URL', () => {
|
||||
const pathname = '/test';
|
||||
expect(absoluteUrl(pathname)).toBe('https://example.com/test');
|
||||
});
|
||||
|
||||
it('should handle empty pathname', () => {
|
||||
const pathname = '';
|
||||
expect(absoluteUrl(pathname)).toBe('https://example.com');
|
||||
});
|
||||
});
|
||||
|
||||
describe('cn', () => {
|
||||
it('should merge multiple class names', () => {
|
||||
expect(cn('class1', 'class2')).toBe('class1 class2');
|
||||
});
|
||||
|
||||
it('should handle conditional class names', () => {
|
||||
const isActive = true;
|
||||
expect(cn('base', isActive && 'active')).toBe('base active');
|
||||
|
||||
const isDisabled = false;
|
||||
expect(cn('base', isDisabled && 'disabled')).toBe('base');
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue