Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.
TypeScript adeagent-ideai-agentsautomationbotclaude-codecodexghosttygrok-bothermes-agentmobile-appmuseopenclawopencodeorchestrationpiruntimeterminalworktreesyc-backed
import { describe, expect, it } from 'vitest'
import { formatCurrencyAmount } from './currency-format'
describe('formatCurrencyAmount', () => {
it('formats USD amounts with the dollar symbol', () => {
const formatted = formatCurrencyAmount(12.4, 'USD')
expect(formatted).toMatch(/12[.,]40/)
expect(formatted).toContain('$')
})
it('formats EUR amounts with the euro symbol and thousands separator', () => {
const formatted = formatCurrencyAmount(2000, 'EUR')
expect(formatted).toContain('€')
expect(formatted).toMatch(/2[.,]000/)
})
it('falls back to code + amount for a malformed currency code', () => {
// A non-3-letter code makes Intl.NumberFormat throw, exercising the fallback.
expect(formatCurrencyAmount(9.5, 'ZZ')).toBe('ZZ 9.50')
})
it('defaults blank currency codes to USD', () => {
expect(formatCurrencyAmount(1, ' ')).toContain('$')
})
it('treats non-finite amounts as zero', () => {
expect(formatCurrencyAmount(Number.NaN, 'USD')).toMatch(/0[.,]00/)
})
})