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: '拆柜收货' },
|
|
|
|
|
{ module: 'inventory', name: '托盘管理' }
|
|
|
|
|
])
|
|
|
|
|
assert.equal(operations.find((item) => item.name === '托盘管理')?.route, '/pages/pallet/pallet')
|
2026-08-25 10:39:50 +08:00
|
|
|
|
2026-08-28 10:39:02 +08:00
|
|
|
const pendingNames = ['库存盘点', '商品移库', '换标收货', '换标执行', '换标复核', '库存查询', '库位查询', '托盘查询']
|
2026-08-25 10:39:50 +08:00
|
|
|
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`)
|
2026-08-26 15:59:08 +08:00
|
|
|
assert.equal(operation?.badge, undefined)
|
2026-08-25 10:39:50 +08:00
|
|
|
}
|
|
|
|
|
})
|