formatter tests
Some checks failed
Some checks failed
This commit is contained in:
94
apps/website/lib/formatters/UserStatusFormatter.test.ts
Normal file
94
apps/website/lib/formatters/UserStatusFormatter.test.ts
Normal file
@@ -0,0 +1,94 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { UserStatusFormatter } from './UserStatusFormatter';
|
||||
|
||||
describe('UserStatusFormatter', () => {
|
||||
describe('statusLabel', () => {
|
||||
it('should format "active" correctly', () => {
|
||||
expect(UserStatusFormatter.statusLabel('active')).toBe('Active');
|
||||
});
|
||||
|
||||
it('should format "suspended" correctly', () => {
|
||||
expect(UserStatusFormatter.statusLabel('suspended')).toBe('Suspended');
|
||||
});
|
||||
|
||||
it('should format "deleted" correctly', () => {
|
||||
expect(UserStatusFormatter.statusLabel('deleted')).toBe('Deleted');
|
||||
});
|
||||
|
||||
it('should handle unknown status', () => {
|
||||
expect(UserStatusFormatter.statusLabel('unknown')).toBe('unknown');
|
||||
});
|
||||
});
|
||||
|
||||
describe('statusVariant', () => {
|
||||
it('should return "performance-green" for active status', () => {
|
||||
expect(UserStatusFormatter.statusVariant('active')).toBe('performance-green');
|
||||
});
|
||||
|
||||
it('should return "yellow-500" for suspended status', () => {
|
||||
expect(UserStatusFormatter.statusVariant('suspended')).toBe('yellow-500');
|
||||
});
|
||||
|
||||
it('should return "racing-red" for deleted status', () => {
|
||||
expect(UserStatusFormatter.statusVariant('deleted')).toBe('racing-red');
|
||||
});
|
||||
|
||||
it('should return "gray-500" for unknown status', () => {
|
||||
expect(UserStatusFormatter.statusVariant('unknown')).toBe('gray-500');
|
||||
});
|
||||
});
|
||||
|
||||
describe('canSuspend', () => {
|
||||
it('should return true for active status', () => {
|
||||
expect(UserStatusFormatter.canSuspend('active')).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for suspended status', () => {
|
||||
expect(UserStatusFormatter.canSuspend('suspended')).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for deleted status', () => {
|
||||
expect(UserStatusFormatter.canSuspend('deleted')).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for unknown status', () => {
|
||||
expect(UserStatusFormatter.canSuspend('unknown')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('canActivate', () => {
|
||||
it('should return false for active status', () => {
|
||||
expect(UserStatusFormatter.canActivate('active')).toBe(false);
|
||||
});
|
||||
|
||||
it('should return true for suspended status', () => {
|
||||
expect(UserStatusFormatter.canActivate('suspended')).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for deleted status', () => {
|
||||
expect(UserStatusFormatter.canActivate('deleted')).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for unknown status', () => {
|
||||
expect(UserStatusFormatter.canActivate('unknown')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('canDelete', () => {
|
||||
it('should return true for active status', () => {
|
||||
expect(UserStatusFormatter.canDelete('active')).toBe(true);
|
||||
});
|
||||
|
||||
it('should return true for suspended status', () => {
|
||||
expect(UserStatusFormatter.canDelete('suspended')).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for deleted status', () => {
|
||||
expect(UserStatusFormatter.canDelete('deleted')).toBe(false);
|
||||
});
|
||||
|
||||
it('should return true for unknown status', () => {
|
||||
expect(UserStatusFormatter.canDelete('unknown')).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user