Files
orca/src/shared/credit-count-format.test.ts
T
Neilandmmarabel 2b0ce17514 Show provider credit balances alongside usage limits (#25408)
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>
2026-10-05 00:07:23 -07:00

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')
})
})