Files
Sankofa/src/lib/design-system.test.ts

44 lines
1.6 KiB
TypeScript
Raw Normal View History

import { describe, it, expect } from 'vitest'
import { getHealthScoreColor, getPillarColor, pillars } from './design-system'
describe('Design System Utilities', () => {
describe('getHealthScoreColor', () => {
it('should return excellent color for scores >= 90', () => {
expect(getHealthScoreColor(90)).toBe('#00FF88')
expect(getHealthScoreColor(100)).toBe('#00FF88')
})
it('should return good color for scores >= 70', () => {
expect(getHealthScoreColor(70)).toBe('#FFB800')
expect(getHealthScoreColor(89)).toBe('#FFB800')
})
it('should return fair color for scores >= 50', () => {
expect(getHealthScoreColor(50)).toBe('#FF8C00')
expect(getHealthScoreColor(69)).toBe('#FF8C00')
})
it('should return poor color for scores < 50', () => {
expect(getHealthScoreColor(49)).toBe('#FF0040')
expect(getHealthScoreColor(0)).toBe('#FF0040')
})
})
describe('getPillarColor', () => {
it('should return correct color for each pillar', () => {
expect(getPillarColor('SECURITY')).toBe('#FF0040')
expect(getPillarColor('RELIABILITY')).toBe('#00FF88')
expect(getPillarColor('COST_OPTIMIZATION')).toBe('#00FFFF')
expect(getPillarColor('PERFORMANCE_EFFICIENCY')).toBe('#00FFD1')
expect(getPillarColor('OPERATIONAL_EXCELLENCE')).toBe('#FF00FF')
expect(getPillarColor('SUSTAINABILITY')).toBe('#00FF88')
})
it('should return default color for invalid pillar', () => {
// @ts-expect-error - testing invalid input
expect(getPillarColor('INVALID')).toBe('#00FFFF')
})
})
})