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
This commit is contained in:
pulse-triage[bot]
2026-09-06 13:04:56 +01:00
parent 7cb3a361a7
commit f0466ce2cf
@@ -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();
}
}),
);
});
});