feat(dispatch): show original and remaining handover quantities

This commit is contained in:
2026-10-03 13:28:23 +08:00
parent a1a8bb4b8b
commit 12de982dac
3 changed files with 8 additions and 4 deletions
+4 -2
View File
@@ -7,8 +7,8 @@ import { session } from '../src/stores/session.js'
const wire = () => ({ dispatchNo: 'PC-ONE', tripNo: 'TR-ONE', tripStatus: 'IN_TRANSIT', tripRecordVersion: '90071992547409931',
originalDeparture: { vehiclePlate: 'ORIGINAL', driverName: '原司机' },
deliveries: [{ deliveryNo: 'DL-DONE', status: 'DELIVERED', packages: '10', terminalAt: '2026-10-03T01:00:00Z', transport: { vehiclePlate: 'ORIGINAL', driverName: '原司机' } },
{ deliveryNo: 'DL-PENDING', status: 'WAIT_DELIVERY', packages: 20, terminalAt: null, transport: { vehiclePlate: 'NEW', driverName: '接替司机' } }], latestHandover: null })
deliveries: [{ deliveryNo: 'DL-DONE', status: 'DELIVERED', packages: '10', remainingPackages: 0, terminalAt: '2026-10-03T01:00:00Z', transport: { vehiclePlate: 'ORIGINAL', driverName: '原司机' } },
{ deliveryNo: 'DL-PENDING', status: 'WAIT_DELIVERY', packages: 20, remainingPackages: 16, terminalAt: null, transport: { vehiclePlate: 'NEW', driverName: '接替司机' } }], latestHandover: null })
test('PDA query stays a GET in the dedicated namespace and never supplies customer or warehouse', async () => {
const calls = []; session.apiBase = '/gateway-api'; session.token = 'test-token'
@@ -23,6 +23,8 @@ test('normalization exposes only business references and does not replace missin
const value = normalizeHandoverStatus(data)
assert.doesNotMatch(JSON.stringify(value), /secret-/); assert.equal(value.originalDeparture.vehiclePlate, '')
assert.equal(value.deliveries[0].packages, 10)
assert.equal(value.deliveries[1].remainingPackages, 16)
for (const remainingPackages of [null, '', -1, 21, '1.5']) assert.throws(() => normalizeHandoverStatus({ ...data, deliveries: [{ ...data.deliveries[1], remainingPackages }] }), /剩余箱数无效/)
for (const packages of [null, '', -1, 0, '1.5']) assert.throws(() => normalizeHandoverStatus({ ...data, deliveries: [{ ...data.deliveries[0], packages }] }), /箱数无效/)
})
test('a response for another dispatch is rejected', async () => {