mirror of
https://github.com/stablyai/orca.git
synced 2026-10-26 00:03:55 +00:00
Display provider credit and currency balances separately from rate limits. Preserve quotas when balance data is unavailable and translate complete labels. Supersedes #9363; credit to @mmarabel for the original implementation. Co-authored-by: mmarabel <166927047+mmarabel@users.noreply.github.com>
15 lines
522 B
TypeScript
15 lines
522 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { formatCreditCount } from './credit-count-format'
|
|
|
|
describe('formatCreditCount', () => {
|
|
it('uses the viewer locale for grouped credit counts', () => {
|
|
const expected = new Intl.NumberFormat(undefined, { maximumFractionDigits: 20 }).format(1234)
|
|
expect(formatCreditCount(1234)).toBe(expected)
|
|
})
|
|
|
|
it('normalizes invalid and negative counts', () => {
|
|
expect(formatCreditCount(Number.NaN)).toBe('0')
|
|
expect(formatCreditCount(-5)).toBe('0')
|
|
})
|
|
})
|