formatter tests
Some checks failed
Some checks failed
This commit is contained in:
48
apps/website/lib/formatters/MemberFormatter.test.ts
Normal file
48
apps/website/lib/formatters/MemberFormatter.test.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { MemberFormatter } from './MemberFormatter';
|
||||
|
||||
describe('MemberFormatter', () => {
|
||||
describe('formatCount', () => {
|
||||
it('should format 1 member correctly', () => {
|
||||
expect(MemberFormatter.formatCount(1)).toBe('1 member');
|
||||
});
|
||||
|
||||
it('should format 2 members correctly', () => {
|
||||
expect(MemberFormatter.formatCount(2)).toBe('2 members');
|
||||
});
|
||||
|
||||
it('should format 0 members correctly', () => {
|
||||
expect(MemberFormatter.formatCount(0)).toBe('0 members');
|
||||
});
|
||||
|
||||
it('should format large numbers correctly', () => {
|
||||
expect(MemberFormatter.formatCount(100)).toBe('100 members');
|
||||
});
|
||||
|
||||
it('should handle negative numbers', () => {
|
||||
expect(MemberFormatter.formatCount(-1)).toBe('-1 members');
|
||||
});
|
||||
});
|
||||
|
||||
describe('formatUnits', () => {
|
||||
it('should format 1 unit correctly', () => {
|
||||
expect(MemberFormatter.formatUnits(1)).toBe('1 Unit');
|
||||
});
|
||||
|
||||
it('should format 2 units correctly', () => {
|
||||
expect(MemberFormatter.formatUnits(2)).toBe('2 Units');
|
||||
});
|
||||
|
||||
it('should format 0 units correctly', () => {
|
||||
expect(MemberFormatter.formatUnits(0)).toBe('0 Units');
|
||||
});
|
||||
|
||||
it('should format large numbers correctly', () => {
|
||||
expect(MemberFormatter.formatUnits(100)).toBe('100 Units');
|
||||
});
|
||||
|
||||
it('should handle negative numbers', () => {
|
||||
expect(MemberFormatter.formatUnits(-1)).toBe('-1 Units');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user