feat(appointment): complete customer receiving and trip continuation workflows
This commit is contained in:
@@ -46,8 +46,8 @@ const expectedBatch = { draftToken: 'original-draft', groups: [
|
||||
{ draftContainerId: 'container-1', planPalletIds: ['11', '13'], returnReceiptIds: [] },
|
||||
{ draftContainerId: 'container-2', planPalletIds: ['14'], returnReceiptIds: ['22'] },
|
||||
] }
|
||||
const goodResult = [{ draftContainerId: 'container-2', dispatch: { id: '102', dispatchNo: 'DS-2' } },
|
||||
{ draftContainerId: 'container-1', dispatch: { id: '101', dispatchNo: 'DS-1' } }]
|
||||
const goodResult = [{ draftContainerId: 'container-2', dispatch: { id: '102', dispatchNo: 'DS-2', appointmentBatches: [] } },
|
||||
{ draftContainerId: 'container-1', dispatch: { id: '101', dispatchNo: 'DS-1', appointmentBatches: [] } }]
|
||||
async function submitDraft(wrapper: ReturnType<typeof mountDraft>) {
|
||||
await wrapper.findAll('button').find(node => node.text() === '预排车')!.trigger('click')
|
||||
await flushPromises()
|
||||
@@ -70,7 +70,7 @@ it.each([
|
||||
['foreign container', [{ ...goodResult[0], draftContainerId: 'foreign' }, goodResult[1]]],
|
||||
['duplicate container', [goodResult[0], goodResult[0]]],
|
||||
['duplicate dispatch', [goodResult[0], { ...goodResult[1], dispatch: goodResult[0].dispatch }]],
|
||||
['missing business number', [goodResult[0], { ...goodResult[1], dispatch: { id: '101', dispatchNo: '' } }]],
|
||||
['missing business number', [goodResult[0], { ...goodResult[1], dispatch: { id: '101', dispatchNo: '', appointmentBatches: [] } }]],
|
||||
])('retains the original groups and token after %s', async (_label, result) => {
|
||||
vi.mocked(listDispatchDrafts).mockResolvedValue([twoGroups])
|
||||
vi.mocked(listDispatchCandidates).mockResolvedValue([plan, secondPlan, thirdPlan, returned])
|
||||
@@ -115,7 +115,7 @@ it('submits relabel physical pallet identity without requiring an inbound plan p
|
||||
{ id: 'container', capacity: 30, palletIds: ['101'] },
|
||||
] }])
|
||||
vi.mocked(listDispatchCandidates).mockResolvedValue([{ ...plan, planPalletId: null, sourceStage: 'RELABEL', orderRefs: 'RL-1' }])
|
||||
vi.mocked(preArrangeDispatch).mockResolvedValue({ id: '1', dispatchNo: 'DS-1' })
|
||||
vi.mocked(preArrangeDispatch).mockResolvedValue({ id: '1', dispatchNo: 'DS-1', appointmentBatches: [] })
|
||||
const wrapper = mountDraft(); await flushPromises(); await submitDraft(wrapper)
|
||||
expect(preArrangeDispatch).toHaveBeenCalledExactlyOnceWith({ planPalletIds: ['101'], returnReceiptIds: [], relabelNo: 'RL-1' })
|
||||
expect(preArrangeDraftDispatch).not.toHaveBeenCalled()
|
||||
@@ -197,7 +197,7 @@ it('keeps one complete relabel order on the single-dispatch endpoint', async ()
|
||||
{ id: 'c1', capacity: 30, palletIds: ['11', '13'] },
|
||||
] }])
|
||||
vi.mocked(listDispatchCandidates).mockResolvedValue([plan, secondPlan].map(p => ({ ...p, sourceStage: 'RELABEL', orderRefs: 'RL-1' })))
|
||||
vi.mocked(preArrangeDispatch).mockResolvedValue({ id: '1', dispatchNo: 'DS-RL' })
|
||||
vi.mocked(preArrangeDispatch).mockResolvedValue({ id: '1', dispatchNo: 'DS-RL', appointmentBatches: [] })
|
||||
const wrapper = mountDraft(); await flushPromises(); await submitDraft(wrapper)
|
||||
expect(preArrangeDispatch).toHaveBeenCalledExactlyOnceWith({ planPalletIds: ['11', '13'], returnReceiptIds: [], relabelNo: 'RL-1' })
|
||||
expect(preArrangeDraftDispatch).not.toHaveBeenCalled()
|
||||
@@ -206,7 +206,7 @@ it('keeps one complete relabel order on the single-dispatch endpoint', async ()
|
||||
})
|
||||
|
||||
it('retains every restored selection on candidate failure and submits both sources only after retry hydration', async () => {
|
||||
vi.mocked(preArrangeDraftDispatch).mockResolvedValue([{ draftContainerId: 'container', dispatch: { id: '1', dispatchNo: 'DS-1' } }])
|
||||
vi.mocked(preArrangeDraftDispatch).mockResolvedValue([{ draftContainerId: 'container', dispatch: { id: '1', dispatchNo: 'DS-1', appointmentBatches: [] } }])
|
||||
vi.mocked(listDispatchDrafts).mockResolvedValue([{ draftToken: 'original-draft', containers: [{ id: 'container', capacity: 30, palletIds: ['11', 'RETURN:22'] }] }])
|
||||
vi.mocked(listDispatchCandidates)
|
||||
.mockResolvedValueOnce([plan])
|
||||
|
||||
Reference in New Issue
Block a user