fix(dispatch): preserve return sources when restoring prearrangement drafts
This commit is contained in:
@@ -5,6 +5,21 @@ import { cancelDispatch, createDispatchDraftContainer, deleteDispatchDraftContai
|
||||
vi.mock('@/shared/api/http', async (importOriginal) => ({ ...(await importOriginal<typeof import('@/shared/api/http')>()), http: { get: vi.fn(), post: vi.fn(), put: vi.fn(), delete: vi.fn() } }))
|
||||
|
||||
describe('dispatch overseas API', () => {
|
||||
it('locks and submits actual return receipts without pretending they are plan pallets', async () => {
|
||||
vi.mocked(http.post).mockResolvedValue({ code: '200', data: null })
|
||||
await lockDispatchDraftPallet('RETURN:190000000000000099', 'draft-return', 'container-1')
|
||||
expect(http.post).toHaveBeenLastCalledWith('/platform/v1/last-leg/dispatches/draft-locks/lock', {
|
||||
sourceType: 'RETURN_RECEIPT', returnReceiptId: '190000000000000099', draftToken: 'draft-return', draftContainerId: 'container-1',
|
||||
})
|
||||
await unlockDispatchDraftPallet('RETURN:190000000000000099', 'draft-return')
|
||||
expect(http.post).toHaveBeenLastCalledWith('/platform/v1/last-leg/dispatches/draft-locks/unlock', {
|
||||
sourceType: 'RETURN_RECEIPT', returnReceiptId: '190000000000000099', draftToken: 'draft-return',
|
||||
})
|
||||
await preArrangeDispatch({ planPalletIds: [], returnReceiptIds: ['190000000000000099'], draftToken: 'draft-return' })
|
||||
expect(http.post).toHaveBeenLastCalledWith('/platform/v1/last-leg/dispatches/pre-arrange', {
|
||||
planPalletIds: [], returnReceiptIds: ['190000000000000099'], draftToken: 'draft-return',
|
||||
})
|
||||
})
|
||||
it('reads external freight from the scoped dispatch without a supplied customer', async () => {
|
||||
vi.mocked(http.get).mockResolvedValue({ code: '200', data: { snapshotHash: 'hash', requiresDeliveryFee: false, quotes: [] } })
|
||||
expect(await getDispatchExternalFreight('DP/1')).toEqual({ snapshotHash: 'hash', requiresDeliveryFee: false, quotes: [] })
|
||||
|
||||
Reference in New Issue
Block a user