2026-08-25 10:39:50 +08:00
|
|
|
import test from 'node:test'
|
|
|
|
|
import assert from 'node:assert/strict'
|
|
|
|
|
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)
|
2026-08-28 10:39:02 +08:00
|
|
|
assert.deepEqual(enabled.map(({ module, name }) => ({ module, name })), [
|
|
|
|
|
{ module: 'inbound', name: '拆柜收货' },
|
2026-10-26 16:05:05 +08:00
|
|
|
{ module: 'inbound', name: '仓储转运测量列表' }, { module: 'inbound', name: '转运测量' },
|
2026-09-10 22:43:11 +08:00
|
|
|
{ module: 'inbound', name: '退货入库' },
|
2026-10-26 16:05:05 +08:00
|
|
|
{ module: 'inbound', name: '合箱' },
|
|
|
|
|
{ module: 'inbound', name: '退货清点' },
|
|
|
|
|
{ module: 'outbound', name: '拣货' },
|
|
|
|
|
{ module: 'outbound', name: '出库' },
|
2026-09-04 12:42:17 +08:00
|
|
|
{ module: 'inventory', name: '商品移库' },
|
|
|
|
|
{ module: 'inventory', name: '托盘管理' },
|
2026-09-15 15:20:43 +08:00
|
|
|
{ module: 'relabel', name: '换标列表' },
|
2026-09-04 12:42:17 +08:00
|
|
|
{ module: 'relabel', name: '换标执行' },
|
|
|
|
|
{ module: 'relabel', name: '换标复核' },
|
|
|
|
|
{ module: 'query', name: '库存查询' },
|
|
|
|
|
{ module: 'query', name: '库位查询' },
|
|
|
|
|
{ module: 'query', name: '托盘查询' }
|
2026-08-28 10:39:02 +08:00
|
|
|
])
|
|
|
|
|
assert.equal(operations.find((item) => item.name === '托盘管理')?.route, '/pages/pallet/pallet')
|
2026-10-26 16:05:05 +08:00
|
|
|
assert.equal(operations.find((item) => item.name === '拣货')?.route, '/pages/dispatch/dispatch')
|
|
|
|
|
assert.equal(operations.find((item) => item.name === '出库')?.route, '/pages/outbound/outbound')
|
2026-09-10 22:43:11 +08:00
|
|
|
assert.equal(operations.find((item) => item.name === '退货入库')?.route, '/pages/return-receipt/return-receipt')
|
2026-10-26 16:05:05 +08:00
|
|
|
assert.equal(operations.find((item) => item.name === '合箱')?.route, '/pages/return-packing/return-packing')
|
|
|
|
|
assert.equal(operations.find((item) => item.name === '退货清点')?.route, '/pages/return-counting/return-counting')
|
2026-09-24 08:55:38 +08:00
|
|
|
assert.equal(operations.find((item) => item.name === '仓储转运测量列表')?.route, '/pages/warehouse-transfer/warehouse-transfer?mode=list')
|
2026-10-26 16:05:05 +08:00
|
|
|
assert.equal(operations.find((item) => item.name === '转运测量')?.route, '/pages/warehouse-transfer/warehouse-transfer?mode=work')
|
2026-08-25 10:39:50 +08:00
|
|
|
|
2026-09-11 16:17:27 +08:00
|
|
|
assert.equal(operations.some((item) => item.name === '库存盘点'), false)
|
|
|
|
|
|
2026-09-15 15:20:43 +08:00
|
|
|
for (const name of ['商品移库', '换标列表', '换标执行', '换标复核', '库存查询', '库位查询', '托盘查询']) {
|
2026-08-25 10:39:50 +08:00
|
|
|
const operation = operations.find((item) => item.name === name)
|
2026-09-04 12:42:17 +08:00
|
|
|
assert.equal(operation?.available, true)
|
|
|
|
|
assert.match(operation?.route || '', /^\/pages\//)
|
2026-08-25 10:39:50 +08:00
|
|
|
}
|
|
|
|
|
})
|