Files
pda-overseas-uniapp/tests/project-contract.test.mjs
T

37 lines
1.8 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 operation page consumes hardware scans', async () => {
const [login, operation] = await Promise.all([
read('../src/pages/login/login.vue'), read('../src/pages/operation/operation.vue')
])
assert.match(login, /柏悦物流海外版/)
assert.doesNotMatch(login, /ChangeMe|platform_admin/)
assert.match(operation, /startScanBroadcast/)
assert.match(operation, /业务接口待接入/)
})