The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
import { describe, expect, it } from 'vitest'
import { cacheHitLabel, tokensPerSecondLabel } from '@/lib/statusbar'
const base = { calls: 0, input: 0, output: 0, total: 0 }
describe('statusbar usage readouts', () => {
it('paints the backend cache-hit and throughput fields, and stays blank when they are absent', () => {
// The backend omits both fields (rather than sending 0) when it has no data
// — a provider with no cache reads, or a session before its first call.
expect(cacheHitLabel(base)).toBe('')
expect(tokensPerSecondLabel(base)).toBe('')
expect(cacheHitLabel({ ...base, cache_hit_pct: 87 })).toBe('87%')
expect(tokensPerSecondLabel({ ...base, avg_tps: 41.6 })).toBe('42 t/s')
})
})