InstanceNode.utils.test.ts29 lines · main
| 1 | import { describe, expect, it } from 'vitest' |
| 2 | |
| 3 | import { metricColor } from './InstanceNode.utils' |
| 4 | |
| 5 | describe('metricColor', () => { |
| 6 | it('returns warning color at 80%', () => { |
| 7 | expect(metricColor(80)).toBe('text-warning') |
| 8 | }) |
| 9 | |
| 10 | it('returns warning color between 80% and 90%', () => { |
| 11 | expect(metricColor(85)).toBe('text-warning') |
| 12 | expect(metricColor(89)).toBe('text-warning') |
| 13 | }) |
| 14 | |
| 15 | it('returns destructive color at 90%', () => { |
| 16 | expect(metricColor(90)).toBe('text-destructive') |
| 17 | }) |
| 18 | |
| 19 | it('returns destructive color above 90%', () => { |
| 20 | expect(metricColor(95)).toBe('text-destructive') |
| 21 | expect(metricColor(100)).toBe('text-destructive') |
| 22 | }) |
| 23 | |
| 24 | it('returns light foreground color below 80%', () => { |
| 25 | expect(metricColor(0)).toBe('text-foreground-light') |
| 26 | expect(metricColor(50)).toBe('text-foreground-light') |
| 27 | expect(metricColor(79)).toBe('text-foreground-light') |
| 28 | }) |
| 29 | }) |