54 lines
3.3 KiB
JavaScript
54 lines
3.3 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')
|
|
|
|
test('overseas PDA is an independent Vue 3 app with separate packaging identity', async () => {
|
|
const [manifest, pages, pkg] = await Promise.all([
|
|
read('../src/manifest.json'), read('../src/pages.json'), read('../package.json')
|
|
])
|
|
assert.match(manifest, /"name"\s*:\s*"柏悦物流\s*PDA\s*海外版"/)
|
|
assert.match(manifest, /"packagename"\s*:\s*"com\.baiyuelogistics\.pda\.overseas"/)
|
|
assert.match(manifest, /"vueVersion"\s*:\s*"3"/)
|
|
assert.doesNotMatch(pages, /pages\/picking|pages\/tasks/)
|
|
assert.match(pkg, /"build:app"\s*:\s*"uni build -p app"/)
|
|
})
|
|
|
|
test('overseas workbench contains only confirmed inbound and in-warehouse domains', async () => {
|
|
const [data, session, runtime] = await Promise.all([
|
|
read('../src/data/overseas-workbench.js'), read('../src/stores/session.js'), read('../src/config/runtime.js')
|
|
])
|
|
for (const label of ['入仓作业', '库内作业', '换标作业', '现场查询']) assert.match(data, new RegExp(label))
|
|
for (const excluded of ['集装箱拣货', '装柜取证', '海外派送', '出库履约']) assert.doesNotMatch(data, new RegExp(excluded))
|
|
assert.match(session, /overseas-pda-auth-session/)
|
|
assert.match(runtime, /VITE_OVERSEAS_API_BASE_URL/)
|
|
})
|
|
|
|
test('login has no committed demo credentials and inbound operation implements the locked container flow', async () => {
|
|
const [login, operation, inbound, adapter, overseas] = await Promise.all([
|
|
read('../src/pages/login/login.vue'), read('../src/pages/operation/operation.vue'),
|
|
read('../src/api/inbound.js'), read('../src/api/receiving-adapter.js'), read('../src/api/overseas.js')
|
|
])
|
|
assert.match(login, /柏悦物流海外版/)
|
|
assert.doesNotMatch(login, /ChangeMe|platform_admin/)
|
|
assert.match(operation, /startScanBroadcast/)
|
|
for (const action of ['prepareReceivingContainer', 'getCurrentReceiving', 'resolveCurrentSku', 'resolveCurrentCarton', 'resolveCurrentPallet', 'receiveCurrentBulk', 'receiveCurrentCarton', 'completeCurrentReceiving']) assert.match(operation, new RegExp(action))
|
|
for (const path of ['/candidates', '/prepare', '/unload-photos/files', '/sign', '/skus/resolve', '/cartons/resolve', '/pallets/resolve', '/receipts/bulk', '/receipts/carton', '/complete']) assert.match(inbound, new RegExp(path.replaceAll('/', '\\/')))
|
|
for (const role of ['LICENSE_PLATE', 'CONTAINER_SEAL', 'DOOR_OPEN']) assert.match(adapter, new RegExp(role))
|
|
for (const forbidden of ['customerId', 'planNo', 'allocationId', 'warehouseId', 'locationId']) assert.doesNotMatch(inbound, new RegExp(forbidden))
|
|
assert.match(operation, /isReceivingConflict|recoverCurrentAfterConflict/)
|
|
assert.match(overseas, /replaceTokens|refreshOverseasToken/)
|
|
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')
|
|
])
|
|
assert.doesNotMatch(operation, /prototypeScan|prototypeInput/)
|
|
assert.match(operation, /功能暂未开放|扫码不会提交/)
|
|
assert.match(home, /operation\.badge/)
|
|
assert.match(module, /专用接口、权限与仓库范围契约完成前保持禁用/)
|
|
})
|