优化
This commit is contained in:
@@ -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 \|\| '-'/)
|
||||
})
|
||||
Reference in New Issue
Block a user