This commit is contained in:
2026-08-31 17:10:46 +08:00
parent 410802870d
commit e686e13772
8 changed files with 39 additions and 47 deletions
+2 -3
View File
@@ -63,9 +63,8 @@ test('picking task list uses remote loading orders and never falls back to demo
assert.match(tasks, /\['UNASSIGNED', 'IN_PROGRESS', 'AWAITING_REVIEW', 'PROCESSING', 'COMPLETION_FAILED'\]\.includes\(task\.workflowStatus\)/)
assert.match(tasks, /\['AWAITING_REVIEW', 'COMPLETION_FAILED'\]\.includes\(task\.workflowStatus\) \|\| \(task\.assignmentVersion !== null/)
assert.match(tasks, /暂无待处理的拣货任务/)
assert.match(tasks, /class="task-label">集装箱号<\/text><text class="task-code">\{\{ displayBusinessValue\(task\.currentContainerNo\) \}\}/)
assert.match(tasks, /柜次号 \{\{ displayBusinessValue\(task\.cabinetNo\) \}\}/)
assert.match(tasks, /\{\{ businessReference\(task\) \}\}/)
assert.match(tasks, /class="task-code">\{\{ containerReference\(task\) \}\}/)
assert.doesNotMatch(tasks, /task-identifiers|businessReference\(task\)/)
assert.match(tasks, /button v-for="task in tasks"[\s\S]*?class="task-card"[\s\S]*?@tap="enterTask\(task\)"/)
assert.match(tasks, /records\.filter\(\(task\) => this\.isTaskVisible\(task\)\)/)
assert.match(tasks, /isTaskReady\(task\)[\s\S]*?task\.recordStatus === 'ACTIVE'[\s\S]*?!task\.mergedIntoContainerBookingId/)
+1 -1
View File
@@ -281,7 +281,7 @@ test('picking mutations stay closed until the canonical task has been claimed',
test('completion shows a Chinese server failure with a request correlation id', () => {
assert.match(page, /remoteFailureMessage\(error, fallback = '操作失败'\)/)
assert.match(page, /formatApiError\(error, fallback\)/)
assert.match(page, /import \{ businessReference, displayBusinessValue, formatApiError, sanitizeUserMessage \}/)
assert.match(page, /import \{ containerReference, formatApiError, sanitizeUserMessage \}/)
assert.match(page, /requestIdFromServer: error\.requestId/)
assert.match(page, /this\.remoteFailureMessage\(error, '装柜完成失败'\)/)
})
+1 -1
View File
@@ -11,7 +11,7 @@ test('picking task list exposes only operator-facing production information', as
])
assert.match(tasks, /共 \$\{tasks\.length\} 个待处理任务/)
assert.match(tasks, /\{\{ businessReference\(task\) \}\}/)
assert.match(tasks, /\{\{ containerReference\(task\) \}\}/)
assert.match(tasks, /displayBusinessValue\(task\.warehouseName, '未关联'\)/)
assert.doesNotMatch(tasks, /接口返回|当前接口|apiEnvironment|rawTaskCount|账号:|未命名订单|缺少仓库信息|服务端就绪校验|console\.info/)
assert.doesNotMatch(adapter, /业务单号待同步/)
+11 -7
View File
@@ -1,15 +1,18 @@
import test from 'node:test'
import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import { businessReference, displayBusinessValue, formatApiError, sanitizeUserMessage } from '../utils/user-facing.js'
import { containerReference, displayBusinessValue, formatApiError, sanitizeUserMessage } from '../utils/user-facing.js'
const read = (path) => readFile(new URL(path, import.meta.url), 'utf8')
test('business identifiers never fall back to an internal id', () => {
test('PDA task labels prefer the container number and only fall back to the cabinet number', () => {
assert.equal(displayBusinessValue(null), '—')
assert.equal(displayBusinessValue('', '未关联'), '未关联')
assert.equal(businessReference({ orderNo: 'SO-2026-001', inboundCode: 'RK-2026-002', taskId: '2092889048731414530' }), '订单号 SO-2026-001 · 入仓码 RK-2026-002')
assert.equal(businessReference({ taskId: '2092889048731414530', inboundId: '2092889048731414531' }), '业务编号未关联')
assert.equal(containerReference({ currentContainerNo: 'TSTU0000760', cabinetNo: 'CAB-260830-0008', orderNo: 'FL-1' }), '集装箱号 TSTU0000760')
assert.equal(containerReference({ currentContainerNo: '', boxNo: 'TSTU0000708', cabinetNo: 'CAB-260829-0037' }), '集装箱号 TSTU0000708')
assert.equal(containerReference({ cabinetNo: 'CAB-260830-0008', taskId: '2092889048731414530' }), '柜次号 CAB-260830-0008')
assert.equal(containerReference({ boxNo: '同步中', cabinetNo: 'CAB-260830-0008' }), '柜次号 CAB-260830-0008')
assert.equal(containerReference({ taskId: '2092889048731414530', orderId: '2092889048731414531' }), '集装箱号 —')
})
test('operator errors hide internal ids but retain request and trace evidence', () => {
@@ -37,9 +40,10 @@ test('priority PDA templates do not interpolate internal ids', async () => {
for (const page of pages) {
const template = page.match(/<template>[\s\S]*?<\/template>/)?.[0] || ''
assert.doesNotMatch(template, /\{\{[^}\n]*(?:taskId|inboundId|orderId|loadingPlanId|containerBookingId)[^}\n]*\}\}/)
assert.doesNotMatch(template, /订单号|入仓码|业务编号未关联/)
}
assert.match(pages[0], /formatApiError\(error, '登录失败'\)/)
assert.match(pages[1], /businessReference\(task\)/)
assert.match(pages[2], /businessReference\(currentBox\)/)
assert.match(pages[3], /businessReference\(entry\.box\)/)
assert.match(pages[1], /containerReference\(task\)/)
assert.match(pages[2], /containerReference\(currentBox\)/)
assert.match(pages[3], /containerReference\(entry\.box\)/)
})