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