V13-FE-006: consolidate approved UI and contract hardening
This commit is contained in:
@@ -1,7 +1,16 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { formatCurrency, formatPercent, formatQuantity } from '../financial'
|
||||
import { formatAsOf, formatCurrency, formatPercent, formatQuantity } from '../financial'
|
||||
describe('financial formatters', () => {
|
||||
it('renders missing values as an explicit em dash', () => { expect(formatCurrency(null, 'KRW')).toBe('—'); expect(formatPercent(undefined)).toBe('—') })
|
||||
it('keeps percentage inputs in decimal-return units', () => { expect(formatPercent(0.125, 1)).toContain('12.5') })
|
||||
it('uses bounded quantity precision', () => { expect(formatQuantity(1.234567, 2)).toContain('1.23') })
|
||||
|
||||
it('requires an explicit currency and preserves the currency marker', () => {
|
||||
expect(formatCurrency(1234.5, 'KRW')).toContain('₩')
|
||||
})
|
||||
|
||||
it('formats valid as-of instants in the display timezone and rejects invalid values', () => {
|
||||
expect(formatAsOf('2026-08-12T00:00:00Z')).toContain('2026')
|
||||
expect(formatAsOf('not-a-date')).toBe('—')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user