fix(dispatch): release failed request state and return rejected reviews
This commit is contained in:
@@ -183,24 +183,20 @@ describe('three-column cargo planning through visible controls', () => {
|
||||
expect(view(dialog).text()).not.toContain('原请求结果尚待核对')
|
||||
expect(sessionStorage.getItem(`dispatch-draft-command:${identity.id}`)).toBeNull()
|
||||
})
|
||||
it.each(['CREATE', 'CONTAINER'] as const)('stops after an unknown %s and retries its exact command without auto-locking or recreating', async step => {
|
||||
lostReply = step
|
||||
const dialog = await render(); await warehouseSelected(dialog); await join(dialog, 'PALLET-1')
|
||||
it.each(['CREATE','CONTAINER'] as const)('unlocks after a failed %s and permits a new cargo click',async step=>{
|
||||
lostReply=step
|
||||
const dialog=await render();await warehouseSelected(dialog);await join(dialog,'PALLET-1')
|
||||
expect(api.lockDispatchDraftPallet).not.toHaveBeenCalled()
|
||||
const before = step === 'CREATE' ? clone(vi.mocked(api.createDispatchDraft).mock.calls[0]![0]) : clone(vi.mocked(api.createDispatchDraftContainer).mock.calls[0]![0])
|
||||
await button(dialog, '重试原请求').trigger('click'); await flushPromises()
|
||||
if (step === 'CREATE') {
|
||||
expect(api.createDispatchDraft).toHaveBeenNthCalledWith(2, before)
|
||||
expect(api.createDispatchDraftContainer).not.toHaveBeenCalled()
|
||||
} else {
|
||||
expect(api.createDispatchDraftContainer).toHaveBeenNthCalledWith(2, before)
|
||||
expect(api.createDispatchDraft).toHaveBeenCalledTimes(1)
|
||||
expect(view(dialog).text()).not.toContain('原请求结果尚待核对')
|
||||
expect(sessionStorage.getItem('dispatch-draft-command:'+identity.id)).toBeNull()
|
||||
await join(dialog,'PALLET-1')
|
||||
expect(api.lockDispatchDraftPallet).toHaveBeenCalledOnce()
|
||||
if(step==='CREATE'){
|
||||
const calls=vi.mocked(api.createDispatchDraft).mock.calls
|
||||
expect(calls).toHaveLength(2);expect(calls[1]![0].idempotencyKey).not.toBe(calls[0]![0].idempotencyKey)
|
||||
}else{
|
||||
expect(api.createDispatchDraftContainer).toHaveBeenCalledOnce();expect(api.createDispatchDraft).toHaveBeenCalledOnce()
|
||||
}
|
||||
expect(api.lockDispatchDraftPallet).not.toHaveBeenCalled()
|
||||
await join(dialog, 'PALLET-1')
|
||||
expect(api.createDispatchDraft).toHaveBeenCalledTimes(step === 'CREATE' ? 2 : 1)
|
||||
expect(api.createDispatchDraftContainer).toHaveBeenCalledTimes(step === 'CONTAINER' ? 2 : 1)
|
||||
expect(api.lockDispatchDraftPallet).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
it('keeps the preparation chain frozen while CREATE is in flight', async () => {
|
||||
let resolve!: (value: DispatchDraft) => void
|
||||
|
||||
Reference in New Issue
Block a user