优化
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
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('domestic workbench exposes a real one-click dropship palletization entry', async () => {
|
||||
const [data, home, modulePage, pages] = await Promise.all([
|
||||
read('../data/demo-data.js'), read('../pages/home/home.vue'), read('../pages/module/module.vue'), read('../pages.json')
|
||||
])
|
||||
assert.match(data, /name: '一件代发合托'[\s\S]*?available: true/)
|
||||
assert.match(home, /'一件代发合托': '\/pages\/dropship-tasks\/dropship-tasks'/)
|
||||
assert.match(modulePage, /'一件代发合托': '\/pages\/dropship-tasks\/dropship-tasks'/)
|
||||
assert.match(pages, /pages\/dropship-tasks\/dropship-tasks/)
|
||||
assert.match(pages, /pages\/dropship-palletization\/dropship-palletization/)
|
||||
})
|
||||
|
||||
test('dropship palletization adapter uses only the dedicated production PDA contract', async () => {
|
||||
const api = await read('../api/pda-dropship.js')
|
||||
for (const route of [
|
||||
'/tasks/pending', '/cartons/resolve', '/cartons/count', '/pallets/bind-pending',
|
||||
'/pallets/create-and-bind', '/seal'
|
||||
]) assert.match(api, new RegExp(route.replaceAll('/', '\\/')))
|
||||
assert.match(api, /expectedVersion: pallet\.version/)
|
||||
assert.match(api, /operationId\('count'/)
|
||||
assert.match(api, /operationId\('bind'/)
|
||||
assert.match(api, /operationId\('create-bind'/)
|
||||
assert.match(api, /operationId\('seal'/)
|
||||
assert.doesNotMatch(api, /customerId|tenantId|inboundId/)
|
||||
})
|
||||
|
||||
test('palletization UI supports scan, count, existing or generated pallet, and seal', async () => {
|
||||
const [tasks, work] = await Promise.all([
|
||||
read('../pages/dropship-tasks/dropship-tasks.vue'),
|
||||
read('../pages/dropship-palletization/dropship-palletization.vue')
|
||||
])
|
||||
for (const text of ['待合托任务', '入仓码', '进入作业']) assert.match(tasks, new RegExp(text))
|
||||
for (const text of ['领取并开始合托', '扫箱清点', '差异说明', '绑定到扫描托盘', '生成 DP 托盘并绑定', '确认封托']) assert.match(work, new RegExp(text))
|
||||
assert.match(work, /startScanBroadcast/)
|
||||
assert.match(work, /quantityDiffers[\s\S]*?ACCEPT_VARIANCE/)
|
||||
assert.match(work, /canSeal\(\)[\s\S]*?countedCartons[\s\S]*?totalCartons[\s\S]*?unboundCartons/)
|
||||
assert.match(work, /formatApiError/)
|
||||
assert.doesNotMatch(work, /taskId\s*\}\}|warehouseId\s*\}\}|inboundId\s*\}\}/)
|
||||
})
|
||||
@@ -10,7 +10,8 @@ test('page configuration starts at login and registers independent PDA routes',
|
||||
assert.equal(pages.pages[0].style.navigationStyle, 'custom')
|
||||
assert.deepEqual(pages.pages.map((page) => page.path), [
|
||||
'pages/login/login', 'pages/home/home', 'pages/module/module', 'pages/operation/operation',
|
||||
'pages/tasks/tasks', 'pages/history/history', 'pages/profile/profile', 'pages/scanner-test/scanner-test', 'pages/picking/picking'
|
||||
'pages/tasks/tasks', 'pages/dropship-tasks/dropship-tasks', 'pages/dropship-palletization/dropship-palletization',
|
||||
'pages/history/history', 'pages/profile/profile', 'pages/scanner-test/scanner-test', 'pages/picking/picking'
|
||||
])
|
||||
})
|
||||
|
||||
@@ -87,15 +88,16 @@ test('workbench, module, history and profile are independent sources', async ()
|
||||
for (const text of ['首页', '库内作业', 'home-operation-grid', 'home-operation-primary', '开始作业', 'uni-icons']) assert.match(home, new RegExp(text))
|
||||
assert.doesNotMatch(home, /getPickingOverview|pendingBoxCount|箱待拣/)
|
||||
assert.doesNotMatch(home, /BottomNav|status-strip|task-card/)
|
||||
for (const text of ['业务模块', '业务功能', '第一版本仅开放']) assert.match(module, new RegExp(text))
|
||||
for (const text of ['业务模块', '业务功能', '一件代发合托', '集装箱拣货']) assert.match(module, new RegExp(text))
|
||||
assert.match(home, /:disabled="!operation\.available"/)
|
||||
assert.match(home, /home-operation-disabled/)
|
||||
assert.match(home, /home-operation-meta home-operation-pending/)
|
||||
assert.match(home, /home-operation-meta home-operation-unavailable/)
|
||||
assert.match(home, /openOperation\(operation\) \{ if \(operation\.available\) uni\.navigateTo/)
|
||||
assert.match(home, /openOperation\(operation\)[\s\S]*?if \(!operation\.available\) return[\s\S]*?'一件代发合托': '\/pages\/dropship-tasks\/dropship-tasks'[\s\S]*?routes\[operation\.name\]/)
|
||||
assert.doesNotMatch(home, /pages\/operation\/operation\?module=/)
|
||||
assert.match(module, /:disabled="!operation\.available"/)
|
||||
assert.match(module, /operation-item-disabled/)
|
||||
assert.match(module, /openOperation\(operation\)[\s\S]*?if \(!operation\.available\) return[\s\S]*?'一件代发合托': '\/pages\/dropship-tasks\/dropship-tasks'[\s\S]*?routes\[operation\.name\]/)
|
||||
assert.doesNotMatch(module, /pages\/operation\/operation\?module=/)
|
||||
assert.match(history, /作业记录/)
|
||||
assert.match(profile, /个人中心/)
|
||||
|
||||
Reference in New Issue
Block a user