feat(booking): add safe retries and operational metrics
verify / booking-verify (push) Has been cancelled
verify / booking-verify (push) Has been cancelled
This commit is contained in:
1 parent
c826b6e574
commit
7330ac853b
26 files changed
+749
-31
No files matched your search
@@ -13,6 +13,7 @@ vi.mock('@/services/reservationService', async (importOriginal) => {
|
||||
...actual,
|
||||
fetchBookingProcessingRun: vi.fn(),
|
||||
confirmBookingProcessingRun: vi.fn(),
|
||||
retryBookingProcessingRun: vi.fn(),
|
||||
}
|
||||
})
|
||||
|
||||
@@ -22,6 +23,7 @@ describe('ReservationBookingProcessingRunView', () => {
|
||||
beforeEach(() => {
|
||||
vi.mocked(service.fetchBookingProcessingRun).mockReset()
|
||||
vi.mocked(service.confirmBookingProcessingRun).mockReset()
|
||||
vi.mocked(service.retryBookingProcessingRun).mockReset()
|
||||
})
|
||||
|
||||
it('shows the safe confirmation projection and freezes corrected values without a PMS action', async () => {
|
||||
@@ -64,6 +66,38 @@ describe('ReservationBookingProcessingRunView', () => {
|
||||
expect(wrapper.text()).toContain('参数已冻结')
|
||||
expect(wrapper.text()).toContain('已确认')
|
||||
})
|
||||
|
||||
it('retries only a failed processing run and resumes safe polling', async () => {
|
||||
const failed = {
|
||||
...awaitingRun(),
|
||||
status: 'FAILED' as const,
|
||||
result_disposition: 'RISK_NOTIFICATION' as const,
|
||||
retry_count: 0,
|
||||
error_code: 'BOOKING_ORCHESTRATION_FAILED',
|
||||
error_summary: 'Booking processing failed before confirmation.',
|
||||
confirmation_projection: null,
|
||||
}
|
||||
const retried = {
|
||||
...failed,
|
||||
status: 'CONTEXT_READY' as const,
|
||||
retry_count: 1,
|
||||
error_code: null,
|
||||
error_summary: null,
|
||||
}
|
||||
vi.mocked(service.fetchBookingProcessingRun).mockResolvedValue(failed)
|
||||
vi.mocked(service.retryBookingProcessingRun).mockResolvedValue(retried)
|
||||
const wrapper = await mountView()
|
||||
await flushPromises()
|
||||
|
||||
const retryButton = wrapper.findAll('button').find((button) => button.text().includes('重新处理'))
|
||||
expect(retryButton).toBeDefined()
|
||||
await retryButton!.trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
expect(service.retryBookingProcessingRun).toHaveBeenCalledWith('booking-001')
|
||||
expect(wrapper.text()).toContain('上下文已组装')
|
||||
expect(wrapper.text()).toContain('已重新进入处理队列')
|
||||
})
|
||||
})
|
||||
|
||||
async function mountView() {
|
||||
|
||||
Reference in new issue
Block a user