mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-11-26 10:06:31 +00:00
fix(webui): router fixture consistency and panel screenshots
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.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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'])
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
const SEVERITY: Record<string, number> = { open: 3, 'half-open': 2, degraded: 1, closed: 0 }
|
||||
|
||||
/** Sort rank of a breaker status, most severe highest; unknown states rank below closed. */
|
||||
export function statusRank(status: string): number {
|
||||
return SEVERITY[status] ?? -1
|
||||
}
|
||||
Reference in New Issue
Block a user