do to formatters
This commit is contained in:
38
apps/website/lib/formatters/DashboardCountFormatter.test.ts
Normal file
38
apps/website/lib/formatters/DashboardCountFormatter.test.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { DashboardCountFormatter } from './DashboardCountFormatter';
|
||||
|
||||
describe('DashboardCountDisplay', () => {
|
||||
describe('happy paths', () => {
|
||||
it('should format positive numbers correctly', () => {
|
||||
expect(DashboardCountFormatter.format(0)).toBe('0');
|
||||
expect(DashboardCountFormatter.format(1)).toBe('1');
|
||||
expect(DashboardCountFormatter.format(100)).toBe('100');
|
||||
expect(DashboardCountFormatter.format(1000)).toBe('1000');
|
||||
});
|
||||
|
||||
it('should handle null values', () => {
|
||||
expect(DashboardCountFormatter.format(null)).toBe('0');
|
||||
});
|
||||
|
||||
it('should handle undefined values', () => {
|
||||
expect(DashboardCountFormatter.format(undefined)).toBe('0');
|
||||
});
|
||||
});
|
||||
|
||||
describe('edge cases', () => {
|
||||
it('should handle negative numbers', () => {
|
||||
expect(DashboardCountFormatter.format(-1)).toBe('-1');
|
||||
expect(DashboardCountFormatter.format(-100)).toBe('-100');
|
||||
});
|
||||
|
||||
it('should handle large numbers', () => {
|
||||
expect(DashboardCountFormatter.format(999999)).toBe('999999');
|
||||
expect(DashboardCountFormatter.format(1000000)).toBe('1000000');
|
||||
});
|
||||
|
||||
it('should handle decimal numbers', () => {
|
||||
expect(DashboardCountFormatter.format(1.5)).toBe('1.5');
|
||||
expect(DashboardCountFormatter.format(100.99)).toBe('100.99');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user