优化
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
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')
|
||||
|
||||
test('pallet management is enabled through its dedicated real PDA route', async () => {
|
||||
const [workbench, pages, home, module] = await Promise.all([
|
||||
read('../src/data/overseas-workbench.js'), read('../src/pages.json'),
|
||||
read('../src/pages/home/home.vue'), read('../src/pages/module/module.vue')
|
||||
])
|
||||
assert.match(workbench, /key: 'pallet'[\s\S]*available: true[\s\S]*route: '\/pages\/pallet\/pallet'/)
|
||||
assert.match(pages, /pages\/pallet\/pallet/)
|
||||
assert.match(home, /operation\.route \|\|/)
|
||||
assert.match(module, /operation\.route \|\|/)
|
||||
})
|
||||
|
||||
test('pallet API maps only the frozen overseas PDA operation endpoints', async () => {
|
||||
const api = await read('../src/api/pallet.js')
|
||||
for (const path of ['pallets/resolve', 'assemble', 'disassemble', 'swap', 'unbind']) {
|
||||
assert.match(api, new RegExp(path.replace('/', '\\/')))
|
||||
}
|
||||
assert.match(api, /overseasRequest/)
|
||||
for (const forbidden of ['customerId', 'warehouseId', 'locationId']) assert.doesNotMatch(api, new RegExp(forbidden))
|
||||
})
|
||||
|
||||
test('pallet page preserves versions, idempotency and scan diagnostics for real writes', async () => {
|
||||
const page = await read('../src/pages/pallet/pallet.vue')
|
||||
for (const action of ['assemblePallet', 'disassemblePallet', 'swapPallet', 'unbindPallet', 'resolvePallet']) assert.match(page, new RegExp(action))
|
||||
assert.match(page, /startScanBroadcast/)
|
||||
assert.match(page, /activeTarget === 'source'/)
|
||||
assert.match(page, /activeTarget === 'target'/)
|
||||
assert.match(page, /expectedVersion: pallet\.palletVersion/)
|
||||
assert.match(page, /expectedPositionVersion: String\(line\.positionVersion/)
|
||||
assert.match(page, /idempotencyKey: this\.pendingKey/)
|
||||
assert.match(page, /requestId[\s\S]*traceId/)
|
||||
assert.match(page, /isConflict\(error\)[\s\S]*请重新扫描相关托盘[\s\S]*this\.sources = \[\]; this\.target = null/)
|
||||
assert.match(page, /不同目的仓不能合托/)
|
||||
assert.doesNotMatch(page, /模拟成功|customerId:|warehouseId:|locationId:/)
|
||||
})
|
||||
@@ -21,6 +21,7 @@ test('overseas PDA is an independent Vue 3 app with separate packaging identity'
|
||||
assert.match(vite, /removeHeader\('referer'\)/)
|
||||
assert.match(styles, /home-operation-grid[^}]*grid-template-columns:\s*repeat\(3/)
|
||||
assert.match(styles, /home-operation[^}]*width:\s*100%/)
|
||||
assert.doesNotMatch(styles, /home-operation-primary[^}]*grid-column:\s*1\s*\/\s*-1/)
|
||||
})
|
||||
|
||||
test('overseas workbench contains only confirmed inbound and in-warehouse domains', async () => {
|
||||
@@ -79,14 +80,18 @@ test('login has no committed demo credentials and inbound operation implements t
|
||||
assert.match(overseas, /requestId/)
|
||||
})
|
||||
|
||||
test('unimplemented warehouse operations cannot submit prototype scans', async () => {
|
||||
const [operation, home, module] = await Promise.all([
|
||||
read('../src/pages/operation/operation.vue'), read('../src/pages/home/home.vue'), read('../src/pages/module/module.vue')
|
||||
test('remaining unimplemented warehouse operations cannot submit prototype scans', async () => {
|
||||
const [operation, home, module, workbench] = await Promise.all([
|
||||
read('../src/pages/operation/operation.vue'), read('../src/pages/home/home.vue'),
|
||||
read('../src/pages/module/module.vue'), read('../src/data/overseas-workbench.js')
|
||||
])
|
||||
assert.doesNotMatch(operation, /prototypeScan|prototypeInput/)
|
||||
assert.match(operation, /功能暂未开放|扫码不会提交/)
|
||||
assert.match(home, /暂未开放/)
|
||||
assert.match(module, /当前仅开放拆柜收货,其他作业暂未开放/)
|
||||
assert.match(module, /灰色功能尚未开放/)
|
||||
for (const key of ['stocktake', 'move', 'relabelReceive', 'inventoryQuery', 'locationQuery', 'palletQuery']) {
|
||||
assert.match(workbench, new RegExp(`key: '${key}'[^\\n]*available: false`))
|
||||
}
|
||||
})
|
||||
|
||||
test('receiving phases use a compiled container summary with cabinet and aggregate facts', async () => {
|
||||
|
||||
@@ -5,9 +5,13 @@ import { MODULES } from '../src/data/overseas-workbench.js'
|
||||
test('only operations backed by a dedicated overseas PDA contract are enabled', () => {
|
||||
const operations = MODULES.flatMap((module) => module.operations.map((operation) => ({ module: module.key, ...operation })))
|
||||
const enabled = operations.filter((operation) => operation.available)
|
||||
assert.deepEqual(enabled.map(({ module, name }) => ({ module, name })), [{ module: 'inbound', name: '拆柜收货' }])
|
||||
assert.deepEqual(enabled.map(({ module, name }) => ({ module, name })), [
|
||||
{ module: 'inbound', name: '拆柜收货' },
|
||||
{ module: 'inventory', name: '托盘管理' }
|
||||
])
|
||||
assert.equal(operations.find((item) => item.name === '托盘管理')?.route, '/pages/pallet/pallet')
|
||||
|
||||
const pendingNames = ['库存盘点', '商品移库', '托盘管理', '换标收货', '换标执行', '换标复核', '库存查询', '库位查询', '托盘查询']
|
||||
const pendingNames = ['库存盘点', '商品移库', '换标收货', '换标执行', '换标复核', '库存查询', '库位查询', '托盘查询']
|
||||
for (const name of pendingNames) {
|
||||
const operation = operations.find((item) => item.name === name)
|
||||
assert.equal(operation?.available, false, `${name} must fail closed until its PDA API exists`)
|
||||
|
||||
Reference in New Issue
Block a user