优化
This commit is contained in:
@@ -1,6 +1,35 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import test from 'node:test'
|
||||
import { reusablePallets } from './inbound-measurement.mjs'
|
||||
|
||||
test('固定托盘缺失停止造数,不查询其他托盘;补齐后同仓可重新验证', async () => {
|
||||
const requests = [], gaps = [], checks = []
|
||||
let complete = false
|
||||
const context = {
|
||||
context: {},
|
||||
async request(method, path) {
|
||||
requests.push({ method, path })
|
||||
const query = new URL(path, 'http://offline').searchParams
|
||||
const code = query.get('palletCode')
|
||||
assert.ok(code, '固定模式禁止用无编号列表替换缺失资源')
|
||||
return { records: complete || code === 'TP-001'
|
||||
? [{ id: code === 'TP-001' ? '1' : '2', palletCode: code, warehouseId: 'offline-fixed-pallet' }] : [] }
|
||||
},
|
||||
apiSuccess(_module, _name, response) { return response },
|
||||
assert(_module, name, _response, passed) { checks.push({ name, passed }) },
|
||||
addCoverageGap(...args) { gaps.push(args) },
|
||||
}
|
||||
assert.equal(await reusablePallets(context, 'offline-fixed-pallet'), null)
|
||||
assert.equal(requests.length, 2)
|
||||
assert.ok(checks.some(row => !row.passed))
|
||||
assert.equal(gaps[0].at(-1).blocking, true)
|
||||
complete = true
|
||||
assert.deepEqual(await reusablePallets(context, 'offline-fixed-pallet'), [
|
||||
{ id: '1', code: 'TP-001' }, { id: '2', code: 'YW-TP-002' },
|
||||
])
|
||||
assert.equal(requests.length, 4, '失败不得缓存为成功')
|
||||
})
|
||||
|
||||
const acceptance = readFileSync(new URL('../admin-test-env-acceptance.mjs', import.meta.url), 'utf8')
|
||||
const orders = readFileSync(new URL('./orders.mjs', import.meta.url), 'utf8')
|
||||
|
||||
Reference in New Issue
Block a user