Files
traefik-llmgateway/webui/src/lib/cache-savings.spec.ts
T
lukaszraczylo ee49467e64 feat(webui): redesign the admin dashboard around admin tasks
A sidebar replaces the flat tabs with seven pages, and one filter bar
sets the time range, comparison period and scope for all of them.

- Home: spend against budget, forecast, request rate, error rate,
  open breakers, top users and models, recent events and warnings.
- Spend: spend over time with comparison, budget burn-down, an
  attribution drill-down from group to user to model, pricing health
  and cost avoided by free models.
- Consumers: a directory with last seen and limit bars, an access
  matrix, and a detail page per user.
- Models: the catalog with billing prices, fleet latency and error
  rates, and provider health.
- Reliability: error, timeout, failover, 429 and 402 trends, events,
  and latency per provider.
- Config: the redacted config and a change helper that emits YAML or
  users.json snippets to paste into git.
- MCP & Agents: callers per target.

Page state lives in the URL hash, and old tab links map to the new
pages. The replaced views are removed. admin_assets_gen.go is
regenerated.

Claude-Session: https://claude.ai/code/session_01V5jYJNxpDFdJkyyExpADrv
2026-09-23 16:41:01 +01:00

22 lines
765 B
TypeScript

import { describe, expect, it } from 'vitest'
import { cacheSavingsStatus } from './cache-savings'
describe('cacheSavingsStatus (N2)', () => {
it('is unavailable for an hour window, with a reason naming the granularity, not a fabricated $0', () => {
const status = cacheSavingsStatus('hour')
expect(status.available).toBe(false)
expect(status.note).toMatch(/hour/i)
})
it('is available with no caveat for a day window (exact figure)', () => {
expect(cacheSavingsStatus('day')).toEqual({ available: true, note: null })
})
it('is available but notes the 35-day retention cap for a month window', () => {
const status = cacheSavingsStatus('month')
expect(status.available).toBe(true)
expect(status.note).toMatch(/35/)
})
})