formatter tests
Some checks failed
Some checks failed
This commit is contained in:
92
apps/website/lib/formatters/SkillLevelFormatter.test.ts
Normal file
92
apps/website/lib/formatters/SkillLevelFormatter.test.ts
Normal file
@@ -0,0 +1,92 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { SkillLevelFormatter } from './SkillLevelFormatter';
|
||||
|
||||
describe('SkillLevelFormatter', () => {
|
||||
describe('getLabel', () => {
|
||||
it('should return "Pro" for pro level', () => {
|
||||
expect(SkillLevelFormatter.getLabel('pro')).toBe('Pro');
|
||||
});
|
||||
|
||||
it('should return "Advanced" for advanced level', () => {
|
||||
expect(SkillLevelFormatter.getLabel('advanced')).toBe('Advanced');
|
||||
});
|
||||
|
||||
it('should return "Intermediate" for intermediate level', () => {
|
||||
expect(SkillLevelFormatter.getLabel('intermediate')).toBe('Intermediate');
|
||||
});
|
||||
|
||||
it('should return "Beginner" for beginner level', () => {
|
||||
expect(SkillLevelFormatter.getLabel('beginner')).toBe('Beginner');
|
||||
});
|
||||
|
||||
it('should return the input for unknown level', () => {
|
||||
expect(SkillLevelFormatter.getLabel('unknown')).toBe('unknown');
|
||||
});
|
||||
});
|
||||
|
||||
describe('getColor', () => {
|
||||
it('should return "text-yellow-400" for pro level', () => {
|
||||
expect(SkillLevelFormatter.getColor('pro')).toBe('text-yellow-400');
|
||||
});
|
||||
|
||||
it('should return "text-purple-400" for advanced level', () => {
|
||||
expect(SkillLevelFormatter.getColor('advanced')).toBe('text-purple-400');
|
||||
});
|
||||
|
||||
it('should return "text-primary-blue" for intermediate level', () => {
|
||||
expect(SkillLevelFormatter.getColor('intermediate')).toBe('text-primary-blue');
|
||||
});
|
||||
|
||||
it('should return "text-green-400" for beginner level', () => {
|
||||
expect(SkillLevelFormatter.getColor('beginner')).toBe('text-green-400');
|
||||
});
|
||||
|
||||
it('should return "text-gray-400" for unknown level', () => {
|
||||
expect(SkillLevelFormatter.getColor('unknown')).toBe('text-gray-400');
|
||||
});
|
||||
});
|
||||
|
||||
describe('getBgColor', () => {
|
||||
it('should return "bg-yellow-400/10" for pro level', () => {
|
||||
expect(SkillLevelFormatter.getBgColor('pro')).toBe('bg-yellow-400/10');
|
||||
});
|
||||
|
||||
it('should return "bg-purple-400/10" for advanced level', () => {
|
||||
expect(SkillLevelFormatter.getBgColor('advanced')).toBe('bg-purple-400/10');
|
||||
});
|
||||
|
||||
it('should return "bg-primary-blue/10" for intermediate level', () => {
|
||||
expect(SkillLevelFormatter.getBgColor('intermediate')).toBe('bg-primary-blue/10');
|
||||
});
|
||||
|
||||
it('should return "bg-green-400/10" for beginner level', () => {
|
||||
expect(SkillLevelFormatter.getBgColor('beginner')).toBe('bg-green-400/10');
|
||||
});
|
||||
|
||||
it('should return "bg-gray-400/10" for unknown level', () => {
|
||||
expect(SkillLevelFormatter.getBgColor('unknown')).toBe('bg-gray-400/10');
|
||||
});
|
||||
});
|
||||
|
||||
describe('getBorderColor', () => {
|
||||
it('should return "border-yellow-400/30" for pro level', () => {
|
||||
expect(SkillLevelFormatter.getBorderColor('pro')).toBe('border-yellow-400/30');
|
||||
});
|
||||
|
||||
it('should return "border-purple-400/30" for advanced level', () => {
|
||||
expect(SkillLevelFormatter.getBorderColor('advanced')).toBe('border-purple-400/30');
|
||||
});
|
||||
|
||||
it('should return "border-primary-blue/30" for intermediate level', () => {
|
||||
expect(SkillLevelFormatter.getBorderColor('intermediate')).toBe('border-primary-blue/30');
|
||||
});
|
||||
|
||||
it('should return "border-green-400/30" for beginner level', () => {
|
||||
expect(SkillLevelFormatter.getBorderColor('beginner')).toBe('border-green-400/30');
|
||||
});
|
||||
|
||||
it('should return "border-gray-400/30" for unknown level', () => {
|
||||
expect(SkillLevelFormatter.getBorderColor('unknown')).toBe('border-gray-400/30');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user