完善企业编辑页面并修复采购建单重试

This commit is contained in:
2026-10-30 15:42:38 +08:00
parent d6ef770e48
commit 55868177cd
19 changed files with 568 additions and 224 deletions
@@ -1,8 +1,23 @@
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
import ts from 'typescript'
const source = readFileSync(new URL('./inboundBilling.ts', import.meta.url), 'utf8')
const { getChargeModeLabel } = await import(`data:text/javascript;base64,${Buffer.from(ts.transpileModule(source, {
compilerOptions: { module: ts.ModuleKind.ESNext, target: ts.ScriptTarget.ES2022 },
}).outputText).toString('base64')}`)
test('describes the quantity basis from the published fee instead of treating the charge unit as the basis', () => {
assert.equal(getChargeModeLabel('KG', 393, 3.6894, 616.1298), '按体积重计费')
assert.equal(getChargeModeLabel('KG', 700, 3.6894, 616.1298), '按毛重计费')
assert.equal(getChargeModeLabel('KG', 616.1298, 3.6894, 616.1298), '按毛重计费')
assert.equal(getChargeModeLabel('CBM', 600, 1.2, 1.6), '按重量折算体积计费')
assert.equal(getChargeModeLabel('CBM', 600, 2, 1.6), '按体积计费')
assert.equal(getChargeModeLabel('CBM', 600, 1.6, 1.6), '按体积计费')
assert.equal(getChargeModeLabel('KG', 393, 3.6894, Number.NaN), '-')
assert.equal(getChargeModeLabel('KG', Number.POSITIVE_INFINITY, 3.6894, 616.1298), '-')
})
test('formats zero values, currencies, measurements, and backend dates without hardcoded business factors', () => {
assert.match(source, /value === null \|\| value === undefined/)