26 lines
953 B
TypeScript
26 lines
953 B
TypeScript
import {
|
|
CORE_METRICS,
|
|
getOnTimeDeliveryBand,
|
|
getCoreMetric,
|
|
getCoreMetricHref,
|
|
getCoreMetricParams,
|
|
} from './core-metrics'
|
|
|
|
describe('core metrics registry', () => {
|
|
it('提供六个唯一且可解析的指标入口', () => {
|
|
expect(CORE_METRICS).toHaveLength(6)
|
|
expect(new Set(CORE_METRICS.map((metric) => metric.key)).size).toBe(6)
|
|
expect(getCoreMetric('ongoing-projects')?.label).toBe('进行中项目')
|
|
expect(getCoreMetric('unknown')).toBeNull()
|
|
expect(getCoreMetricHref('monthly-launches')).toBe('/workspaces/dashboard/core-metrics/monthly-launches')
|
|
expect(getCoreMetricParams()).toHaveLength(6)
|
|
})
|
|
|
|
it('按确认阈值给按时交付率分配绿色、黄色与红色区间', () => {
|
|
expect(getOnTimeDeliveryBand(95.1)).toBe('green')
|
|
expect(getOnTimeDeliveryBand(95)).toBe('yellow')
|
|
expect(getOnTimeDeliveryBand(90)).toBe('yellow')
|
|
expect(getOnTimeDeliveryBand(89.9)).toBe('red')
|
|
})
|
|
})
|