mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-11-26 10:06:31 +00:00
Router escalation fixtures now scale tiers, reasons and outcomes with requests, and the shadow classifier differs from live. The harness captures each panel's full scroll height, runs checks on the expanded panel, and samples smartrouter/uni. RoutersPage no longer refetches on range change. The breaker State column sorts by severity.
20 lines
922 B
TypeScript
20 lines
922 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { statusRank } from './breaker-severity'
|
|
import { sortThenSlice } from './table-sort'
|
|
|
|
describe('statusRank', () => {
|
|
it('ranks open > half-open > degraded > closed', () => {
|
|
expect(statusRank('open')).toBeGreaterThan(statusRank('half-open'))
|
|
expect(statusRank('half-open')).toBeGreaterThan(statusRank('degraded'))
|
|
expect(statusRank('degraded')).toBeGreaterThan(statusRank('closed'))
|
|
})
|
|
it('ranks an unknown state below closed so it never reads as severe', () => {
|
|
expect(statusRank('mystery')).toBeLessThan(statusRank('closed'))
|
|
})
|
|
it('sorts severity-first, not alphabetically', () => {
|
|
const rows = ['closed', 'open', 'degraded', 'half-open'].map((s) => ({ s, rank: statusRank(s) }))
|
|
expect(sortThenSlice(rows, { key: 'rank', direction: 'desc' }, 10, 0).map((r) => r.s)).toEqual(['open', 'half-open', 'degraded', 'closed'])
|
|
})
|
|
})
|