优化
This commit is contained in:
@@ -85,8 +85,8 @@ test('picking page exposes five evidence slots, retry and remote completion stat
|
||||
for (const text of ['PHOTO_STEP_1', 'PHOTO_STEP_4', 'SEAL', '网络失败', '确认装柜完成']) {
|
||||
assert.match(`${source}\n${page}`, new RegExp(text))
|
||||
}
|
||||
assert.match(page, /createEvidenceUploadQueue/)
|
||||
assert.match(page, /retryEvidence/)
|
||||
assert.match(page, /async queueEvidenceUpload\(type, path, sealNo = null\)/)
|
||||
assert.match(page, /@tap="refreshTask"/)
|
||||
assert.match(page, /uploadEvidenceFile/)
|
||||
assert.match(page, /submitting \|\| \(!pickingCompleted && !summary\.canSubmit\)/)
|
||||
assert.doesNotMatch(page, /completePicking\(/)
|
||||
@@ -135,8 +135,8 @@ test('cabinet evidence never selects an inbound owner or builds a container rout
|
||||
const evidenceAdapter = source.match(/export function getEvidence\(taskId, warehouseId\)[\s\S]*?export function completeContainerPickingTask/)?.[0] || ''
|
||||
for (const field of ['inboundId', 'tenantId', 'containerBookingId']) assert.doesNotMatch(evidenceAdapter, new RegExp(field))
|
||||
assert.match(page, /captureEvidenceIdentity\(\) \{[\s\S]*?taskId:/)
|
||||
assert.match(page, /uploadEvidenceFile\(item\.taskId, item\.warehouseId, item, item\.localPath/)
|
||||
assert.match(page, /queue\.add\(\{ taskId: identity\.taskId, warehouseId: identity\.warehouseId, evidenceType: type, expectedVersion/)
|
||||
assert.match(page, /uploadEvidenceFile\(identity\.taskId, identity\.warehouseId,[\s\S]*?\}, path, progress/)
|
||||
assert.match(page, /evidenceType: type, expectedVersion: current\?\.version \?\? 0, sealNo/)
|
||||
assert.doesNotMatch(page, /evidenceIdentity\?\.inboundId|identity\.inboundId/)
|
||||
assert.doesNotMatch(page, /currentBox\.warehouseId \|\| session\.currentUser/)
|
||||
assert.match(source, /warehouseId=\$\{encodeURIComponent\(warehouseId\)\}/)
|
||||
|
||||
@@ -50,3 +50,8 @@ test('priority PDA templates do not interpolate internal ids', async () => {
|
||||
assert.match(pages[2], /containerReference\(currentBox\)/)
|
||||
assert.match(pages[3], /containerReference\(entry\.box\)/)
|
||||
})
|
||||
|
||||
test('operator messages strip inline diagnostic suffixes', () => {
|
||||
assert.equal(formatApiError({ message: '装柜证据文件上传失败(错误码:S0503;requestId:request-1;traceId:trace-1)' }, '上传失败', false), '装柜证据文件上传失败')
|
||||
assert.equal(formatApiError({ message: '请先完成车辆取货送仓\nrequestId: request-1' }, '操作失败', false), '请先完成车辆取货送仓')
|
||||
})
|
||||
|
||||
@@ -16,7 +16,7 @@ export function containerReference(source = {}) {
|
||||
}
|
||||
|
||||
export function sanitizeUserMessage(message, fallback = '操作失败') {
|
||||
const raw = String(message ?? '').trim()
|
||||
const raw = String(message ?? '').replace(/[((]\s*(?:错误码|code|requestId|traceId)\s*[::=][\s\S]*$/i, '').replace(/(?:requestId|traceId)\s*[::=][\s\S]*$/i, '').trim()
|
||||
if (!raw) return fallback
|
||||
if (/^internal server error$/i.test(raw)) return '服务端处理异常,请联系管理员'
|
||||
const sanitized = raw
|
||||
|
||||
Reference in New Issue
Block a user