This commit is contained in:
2026-10-22 14:38:11 +08:00
parent 29f4791b66
commit 30a0d7ce68
8 changed files with 237 additions and 0 deletions
@@ -15,6 +15,15 @@ beforeEach(() => {
vi.mocked(http.put).mockResolvedValue({ data: command('EDIT') })
vi.mocked(http.delete).mockResolvedValue({ data: draft() })
})
it('reads and writes original dispatch appointment allocations with lossless versions', async () => {
const value = { dispatchNo: 'PC/1', recordVersion: '9007199254740993', items: [], edit: { allowed: true, blockCode: null, blockReason: null } }
vi.mocked(http.get).mockResolvedValueOnce({ data: value })
expect(await api.getDispatchAppointmentAllocations('PC/1')).toEqual(value)
expect(http.get).toHaveBeenCalledWith('/platform/v1/last-leg/dispatches/PC%2F1/appointment-allocations')
const body = { recordVersion: 0, idempotencyKey: 'allocation-key', dispatchItemIds: ['11'], batchAllocations: [{ planPalletId: '21', batchKey: 'FBA_APPOINTMENT:9', customerId: '101', sourceKey: 'ORDER:1', destinationKey: 'FBA:ACY2', packageCount: 10, recordVersion: 0 }] }
await api.saveDispatchAppointmentAllocations('PC/1', body)
expect(http.put).toHaveBeenCalledWith('/platform/v1/last-leg/dispatches/PC%2F1/appointment-allocations', body)
})
describe('native whole-vehicle dispatch API', () => {
it('round-trips this trip maintenance data and its vehicle photo references without altering actual departure', async () => {