From f0466ce2cff452045391e914905efd159f8f2674 Mon Sep 17 00:00:00 2001 From: "pulse-triage[bot]" <249995291+pulse-triage[bot]@users.noreply.github.com> Date: Sun, 6 Sep 2026 13:04:56 +0100 Subject: [PATCH] fix(tests): format delivery failure regression coverage The existing proposal's Frontend job rejected the retained queue-action test because its nested parameterized callback did not match the repository's Prettier output. Apply formatting only so the reviewed behavioural assertions can pass the unchanged frontend gate. Change-source: pulse-maintainer --- .../useNotificationDeliveryHealth.test.tsx | 68 ++++++++++--------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/frontend-modern/src/features/alerts/__tests__/useNotificationDeliveryHealth.test.tsx b/frontend-modern/src/features/alerts/__tests__/useNotificationDeliveryHealth.test.tsx index 328d0f81d..51e63180f 100644 --- a/frontend-modern/src/features/alerts/__tests__/useNotificationDeliveryHealth.test.tsx +++ b/frontend-modern/src/features/alerts/__tests__/useNotificationDeliveryHealth.test.tsx @@ -173,39 +173,43 @@ describe('useNotificationDeliveryHealth', () => { describe.each(['dismissTerminalFailures', 'retryTerminalFailures'] as const)('%s', (action) => { it.each(['cancelled', 'rejected'] as const)( 'preserves retained failure evidence when the action is %s', - (outcome) => createRoot(async (dispose) => { - const confirmSpy = vi.spyOn(window, 'confirm').mockReturnValue(outcome !== 'cancelled'); - const onAfterQueueAction = vi.fn(); - try { - const health = { queue: { status: 'degraded', attentionRequired: 2 } } as never; - vi.mocked(NotificationsAPI.getHealth).mockResolvedValueOnce(health); - const state = useNotificationDeliveryHealth({ onAfterQueueAction }); - await state.loadDeliveryHealth(); - let rejectAction!: (reason: Error) => void; - vi.mocked(NotificationsAPI[action]).mockReturnValueOnce(new Promise((_, reject) => { - rejectAction = reject; - })); - const pending = state[action](); - const busy = action === 'dismissTerminalFailures' - ? state.dismissingTerminalFailures : state.retryingTerminalFailures; - expect(busy()).toBe(outcome === 'rejected'); - if (outcome === 'rejected') rejectAction(new Error('request rejected')); - await pending; + (outcome) => + createRoot(async (dispose) => { + const confirmSpy = vi.spyOn(window, 'confirm').mockReturnValue(outcome !== 'cancelled'); + const onAfterQueueAction = vi.fn(); + try { + const health = { queue: { status: 'degraded', attentionRequired: 2 } } as never; + vi.mocked(NotificationsAPI.getHealth).mockResolvedValueOnce(health); + const state = useNotificationDeliveryHealth({ onAfterQueueAction }); + await state.loadDeliveryHealth(); + let rejectAction!: (reason: Error) => void; + vi.mocked(NotificationsAPI[action]).mockReturnValueOnce( + new Promise((_, reject) => { + rejectAction = reject; + }), + ); + const pending = state[action](); + const busy = + action === 'dismissTerminalFailures' + ? state.dismissingTerminalFailures + : state.retryingTerminalFailures; + expect(busy()).toBe(outcome === 'rejected'); + if (outcome === 'rejected') rejectAction(new Error('request rejected')); + await pending; - expect(confirmSpy).toHaveBeenCalledOnce(); - expect(NotificationsAPI[action]).toHaveBeenCalledTimes(outcome === 'rejected' ? 1 : 0); - expect(NotificationsAPI.getHealth).toHaveBeenCalledTimes(1); - expect(onAfterQueueAction).not.toHaveBeenCalled(); - expect(state.deliveryHealth()).toBe(health); - expect(state.deliveryNeedsAttention()).toBe(true); - expect(state.deliveryHealthUnavailable()).toBe(false); - expect(busy()).toBe(false); - } finally { - confirmSpy.mockRestore(); - dispose(); - } - }), + expect(confirmSpy).toHaveBeenCalledOnce(); + expect(NotificationsAPI[action]).toHaveBeenCalledTimes(outcome === 'rejected' ? 1 : 0); + expect(NotificationsAPI.getHealth).toHaveBeenCalledTimes(1); + expect(onAfterQueueAction).not.toHaveBeenCalled(); + expect(state.deliveryHealth()).toBe(health); + expect(state.deliveryNeedsAttention()).toBe(true); + expect(state.deliveryHealthUnavailable()).toBe(false); + expect(busy()).toBe(false); + } finally { + confirmSpy.mockRestore(); + dispose(); + } + }), ); }); - });