This commit is contained in:
2026-10-09 17:36:34 +08:00
parent 07ba9fcb7c
commit 9891ac3e29
8 changed files with 99 additions and 21 deletions
@@ -0,0 +1,15 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import { readFileSync } from 'node:fs'
import ts from 'typescript'
const source = readFileSync(new URL('./orderProgress.ts', import.meta.url), 'utf8')
const code = ts.transpileModule(source, { compilerOptions: { module: ts.ModuleKind.CommonJS } }).outputText
const exports = {}
new Function('exports', code)(exports)
test('prototype queues preserve order and distinguish partial progress from completion', () => {
assert.deepEqual(exports.ORDER_QUEUES.slice(0, 7).map(q => q.key), ['all','fee','loaded','declared','cleared','scheduled','delivering'])
assert.equal(exports.orderProgressLabel({ stage: 'scheduled', partial: true }), '部分已排车')
assert.equal(exports.orderProgressLabel({ stage: 'cleared', partial: false }), '已清关')
assert.equal(exports.orderProgressLabel({ stage: 'none', partial: false }), '—')
assert.equal(exports.orderProgressLabel(), '—')
})