This commit is contained in:
2026-08-04 21:01:34 +08:00
parent 161bf580c7
commit 2313fd238c
12 changed files with 716 additions and 24 deletions
@@ -0,0 +1,20 @@
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
const source = readFileSync(new URL('./inboundBilling.ts', import.meta.url), 'utf8')
test('formats zero values, currencies, measurements, and backend dates without hardcoded business factors', () => {
assert.match(source, /value === null \|\| value === undefined/)
assert.match(source, /Intl\.NumberFormat\('zh-CN'/)
assert.match(source, /style: 'currency'/)
assert.match(source, /Intl\.DateTimeFormat\('zh-CN'/)
assert.doesNotMatch(source, /\b167\b|\b363\b/)
})
test('translates backend rounding modes into customer-facing calculation labels', () => {
assert.match(source, /export function getRoundingModeLabel/)
assert.match(source, /CEILING: '向上取整'/)
assert.match(source, /HALF_UP: '四舍五入'/)
assert.match(source, /return labels\[value\] \|\| value \|\| '-'/)
})