fix(overseas-pda): localize workflow errors
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
pickDispatchItem, pickOutboundTask, resolveOutboundTask
|
||||
} from '../src/api/fulfillment.js'
|
||||
import { session } from '../src/stores/session.js'
|
||||
import { toDispatchError } from '../src/utils/dispatch-error.js'
|
||||
|
||||
const read = (path) => readFile(new URL(path, import.meta.url), 'utf8')
|
||||
|
||||
@@ -126,13 +127,13 @@ test('pages expose loading empty error offline and permission diagnostics with g
|
||||
assert.match(page, /暂无/)
|
||||
assert.match(page, /requestId[\s\S]*traceId/)
|
||||
assert.match(page, /error\.network[\s\S]*幂等键/)
|
||||
assert.match(page, /A0403[\s\S]*没有海外仓 PDA 作业权限/)
|
||||
assert.match(page, /fulfillmentIdempotencyKey/)
|
||||
assert.match(page, /releaseFulfillmentKey/)
|
||||
assert.match(page, /if \(!this\.can/)
|
||||
assert.doesNotMatch(page, /模拟成功|静默成功|customerId:|warehouseId:|locationId:/)
|
||||
}
|
||||
assert.match(dispatch, /completeDispatchPicking/)
|
||||
assert.match(dispatch, /toDispatchError/)
|
||||
assert.match(dispatch, /this\.remainingPackages === 0/)
|
||||
assert.doesNotMatch(dispatch, /partialReason|reason \}/)
|
||||
assert.match(dispatch, /this\.pickingCompleted && this\.allPicked && this\.current\?\.canDepart === true && !this\.departed/)
|
||||
@@ -153,6 +154,27 @@ test('pages expose loading empty error offline and permission diagnostics with g
|
||||
assert.doesNotMatch(dispatch + outbound, /DeliveryOrder|deliveryStatus|customerVisit|\/deliveries/)
|
||||
})
|
||||
|
||||
test('dispatch vehicle-plate conflict uses actionable Chinese copy and preserves diagnostics', () => {
|
||||
const error = toDispatchError({
|
||||
code: 'A0409',
|
||||
message: 'Vehicle plate is required before PDA push or picking',
|
||||
requestId: 'faccb2ee-5e05-4904-9bef-bc983638b47b',
|
||||
traceId: '43ca73abd84fab3e2992aa50e48fb48f'
|
||||
}, '提交排车拣货失败')
|
||||
assert.deepEqual(error, {
|
||||
message: '请先在平台维护车牌信息后再拣货',
|
||||
code: 'A0409',
|
||||
requestId: 'faccb2ee-5e05-4904-9bef-bc983638b47b',
|
||||
traceId: '43ca73abd84fab3e2992aa50e48fb48f',
|
||||
network: false
|
||||
})
|
||||
|
||||
const unknown = toDispatchError({ code: 'A0409', message: 'Another dispatch conflict', requestId: 'request-2' }, '失败')
|
||||
assert.equal(unknown.message, 'Another dispatch conflict')
|
||||
assert.equal(unknown.requestId, 'request-2')
|
||||
assert.equal(toDispatchError({ code: 'A0403', message: 'Forbidden' }).message, '当前账号没有海外仓 PDA 作业权限,请联系管理员授权')
|
||||
})
|
||||
|
||||
test('receiving conflict recovery keeps request and trace evidence visible on narrow screens', async () => {
|
||||
const operation = await read('../src/pages/operation/operation.vue')
|
||||
assert.match(operation, /openContainer\(candidate\)[\s\S]*recoverCurrentAfterConflict\(error, true\)/)
|
||||
|
||||
Reference in New Issue
Block a user