43 lines
2.8 KiB
JavaScript
43 lines
2.8 KiB
JavaScript
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { readFile } from 'node:fs/promises'
|
|
const read = (path) => readFile(new URL(path, import.meta.url), 'utf8')
|
|
const page = await read('../pages/dropship-palletization/dropship-palletization.vue')
|
|
const api = await read('../api/pda-dropship.js')
|
|
test('pending cartons bind to pregenerated pallets with stable retry identity', async () => {
|
|
const { stableOperationId } = await import('../utils/idempotency.js')
|
|
const payload = { warehouseId: '9007199254740993', palletNo: 'DP-260914-0001', taskVersion: 7 }
|
|
assert.equal(stableOperationId('dropship-bind', 'u-task', payload), stableOperationId('dropship-bind', 'u-task', { ...payload }))
|
|
assert.notEqual(stableOperationId('dropship-bind', 'u-task', payload), stableOperationId('dropship-bind', 'u-task', { ...payload, taskVersion: 8 }))
|
|
assert.match(api, /pallets\/bind-pending/)
|
|
assert.doesNotMatch(api, /create-and-bind/)
|
|
assert.match(page, /bindDropshipPendingCartons\(this.taskId, this.warehouseId, code, this.task.version\)/)
|
|
})
|
|
test('palletization uses the test workbench and canonical routes', async () => {
|
|
const pages = await read('../pages.json')
|
|
assert.match(pages, /pages\/dropship-tasks\/dropship-tasks/)
|
|
assert.match(pages, /pages\/dropship-palletization\/dropship-palletization/)
|
|
assert.doesNotMatch(pages, /dropship-palletizing/)
|
|
assert.match(await read('../pages/home/home.vue'), /'一件代发': '\/pages\/dropship-tasks\/dropship-tasks'/)
|
|
})
|
|
test('formal palletization preserves both scan orders, moves and sealing guards', () => {
|
|
for (const symbol of ['resolveDropshipCarton', 'countDropshipCarton', 'bindDropshipPendingCartons', 'moveDropshipCarton', 'sealDropshipPallet', 'planDropshipScan', 'restoreDropshipPalletizingDraft']) assert.ok(page.includes(symbol))
|
|
assert.match(page, /移回待绑托/)
|
|
assert.match(page, /palletSetupReady/)
|
|
assert.match(page, /pallet.status !== 'OPEN'/)
|
|
assert.match(page, /currentPalletDetails\?\.cartons/)
|
|
assert.doesNotMatch(page, /模拟成功|actualSkuQuantity/)
|
|
})
|
|
test('palletization preserves compact multi-SKU input without desktop printing actions', () => {
|
|
assert.match(page, /v-for="\(line, index\) in skuCounts"/)
|
|
assert.match(page, /quantity-stepper/)
|
|
assert.doesNotMatch(page, /printPallet|printAllPallets|打开当前托盘 A4 单|打开全部 A4 托盘单/)
|
|
})
|
|
test('count and move use the formal multi-SKU contract with versioned retries', () => {
|
|
for (const path of ['cartons/count', 'pallets/bind-pending', '/move', '/seal']) assert.ok(api.includes(path))
|
|
for (const field of ['skuLines', 'actualQuantity', 'discrepancyAction', 'discrepancyRemark']) assert.ok(page.includes(field))
|
|
assert.match(api, /expectedVersion: pallet.version/)
|
|
assert.match(api, /stableOperationId/)
|
|
assert.doesNotMatch(api, /actualSkuQuantity|create-and-bind/)
|
|
})
|