This commit is contained in:
2026-09-11 11:19:47 +08:00
parent 991150e64b
commit f8ebbd9610
10 changed files with 54 additions and 30 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ test('domestic workbench exposes a real one-click dropship palletization entry',
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(data, /key: 'inbound'[\s\S]*?name: '一件代发合托'[\s\S]*?available: true, visible: 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/)
+20 -8
View File
@@ -88,17 +88,17 @@ 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\)[\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(home, /openOperation\(operation\)[\s\S]*?if \(!operation\.available\) return[\s\S]*?'一件代发合托': '\/pages\/dropship-tasks\/dropship-tasks'[\s\S]*?'出库拣货': '\/pages\/tasks\/tasks'[\s\S]*?'库位查询'/)
assert.match(home, /pages\/operation\/operation\?module=query&name=/)
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(module, /openOperation\(operation\)[\s\S]*?if \(!operation\.available\) return[\s\S]*?'一件代发合托': '\/pages\/dropship-tasks\/dropship-tasks'[\s\S]*?'出库拣货': '\/pages\/tasks\/tasks'/)
assert.match(module, /pages\/operation\/operation\?module=\$\{encodeURIComponent\(this\.moduleKey\)\}&name=/)
assert.match(history, /作业记录/)
assert.match(profile, /个人中心/)
assert.match(profile, /signOut\(\)/)
@@ -106,10 +106,22 @@ test('workbench, module, history and profile are independent sources', async ()
assert.doesNotMatch([home, module, history, profile].join('\n'), /BottomNav/)
})
test('demo model contains all four modules and picking belongs to outbound', async () => {
test('home exposes only the three confirmed operations and keeps hidden definitions', async () => {
const data = await read('../data/demo-data.js')
for (const text of ['入库', '出库', '库存', '查询', '集装箱拣货']) assert.match(data, new RegExp(text))
assert.match(data, /key: 'outbound'[\s\S]*?name: '集装箱拣货'[\s\S]*?available: true/)
const { MODULES } = await import('../data/demo-data.js')
for (const text of ['入库', '出库', '库存', '查询', '出库拣货']) assert.match(data, new RegExp(text))
assert.match(data, /key: 'inbound'[\s\S]*?name: '一件代发合托'[\s\S]*?available: true, visible: true/)
assert.match(data, /key: 'outbound'[\s\S]*?name: '出库拣货'[\s\S]*?available: true, visible: true/)
assert.match(data, /key: 'query'[\s\S]*?name: '库位查询'[\s\S]*?available: true, visible: true/)
assert.match(await read('../pages/home/home.vue'), /operations: module\.operations\.filter\(\(operation\) => operation\.visible\)/)
assert.deepEqual(MODULES.flatMap((module) => module.operations
.filter((operation) => operation.visible)
.map((operation) => `${module.key}:${operation.name}`)), [
'inbound:一件代发合托',
'outbound:出库拣货',
'query:库位查询'
])
assert.ok(MODULES.flatMap((module) => module.operations).some((operation) => operation.name === '到货收货' && !operation.visible))
for (const boxNo of ['CBX-20260709-001', 'CBX-20260709-002', 'CBX-20260709-003']) assert.match(data, new RegExp(boxNo))
})