60 lines
3.6 KiB
JavaScript
60 lines
3.6 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*"柏悦物流海外版"/)
|
|
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 consumes real overseas APIs', async () => {
|
|
const [login, operation, inbound, overseas] = await Promise.all([
|
|
read('../src/pages/login/login.vue'), read('../src/pages/operation/operation.vue'),
|
|
read('../src/api/inbound.js'), read('../src/api/overseas.js')
|
|
])
|
|
assert.match(login, /柏悦物流海外版/)
|
|
assert.doesNotMatch(login, /ChangeMe|platform_admin/)
|
|
assert.match(operation, /startScanBroadcast/)
|
|
for (const action of ['pushInboundTask', 'assignInboundPallet', 'countInboundPackages', 'pickInboundPackages', 'scanInboundCarton', 'uploadUnloadPhotoFile', 'bindUnloadPhotos', 'completeInboundTask']) assert.match(operation, new RegExp(action))
|
|
for (const path of ['/push', '/allocations/', '/cartons/scan', '/unload-photos', '/complete']) assert.match(inbound, new RegExp(path.replace('/', '\\/')))
|
|
assert.match(overseas, /replaceTokens|refreshOverseasToken/)
|
|
assert.match(overseas, /requestId/)
|
|
})
|
|
|
|
test('container receiving uses sign then locked-container receiving without internal IDs', async () => {
|
|
const [pages, workbench, api, sign, receiving] = await Promise.all([
|
|
read('../src/pages.json'), read('../src/data/overseas-workbench.js'), read('../src/api/receiving.js'),
|
|
read('../src/pages/inbound-sign/inbound-sign.vue'), read('../src/pages/inbound-receiving/inbound-receiving.vue')
|
|
])
|
|
assert.match(pages, /pages\/inbound-sign\/inbound-sign/)
|
|
assert.match(pages, /pages\/inbound-receiving\/inbound-receiving/)
|
|
assert.match(workbench, /入库签收/)
|
|
assert.match(workbench, /name: '收货'/)
|
|
for (const path of ['/active', '/sign-photos/files', '/sign', '/cartons/resolve', '/pallets/resolve', '/receive-batches', '/complete']) assert.match(api, new RegExp(path.replaceAll('/', '\\/')))
|
|
assert.match(sign, /当前柜完成前不能处理其他柜号/)
|
|
assert.doesNotMatch(sign, /切换柜号|customerId|planNo|allocationId|warehouseId|locationId/)
|
|
assert.match(receiving, /receiptMode: 'BULK_COUNT'/)
|
|
assert.match(receiving, /receiptMode: 'CARTON_SCAN'/)
|
|
assert.match(receiving, /cargo\.destinationType === 'FBA'/)
|
|
assert.match(receiving, /cargo\?\.destinationType === 'OVERSEAS'/)
|
|
assert.doesNotMatch(receiving, /切换柜号|customerId|planNo|allocationId|warehouseId|locationId/)
|
|
})
|