From 7cb3a361a773fecc3cac8fd47ba53e0298034bff Mon Sep 17 00:00:00 2001 From: "pulse-triage[bot]" <249995291+pulse-triage[bot]@users.noreply.github.com> Date: Sun, 6 Sep 2026 12:45:30 +0100 Subject: [PATCH] test(alerts): protect delivery warning transitions and busy controls Keep unavailable status from presenting stale failure advice and prevent conflicting retry/dismiss controls while queue actions are pending. Existing hook tests cover request ordering, but rendered transition and busy-state behaviour lacked direct regression assertions. Focused tests pass; removing status precedence or mutual disabling makes the new cases fail. Change-source: pulse-maintainer --- .../alerts/AlertDeliveryHealthCard.test.tsx | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/frontend-modern/src/features/alerts/AlertDeliveryHealthCard.test.tsx b/frontend-modern/src/features/alerts/AlertDeliveryHealthCard.test.tsx index 2651c01da..49c738dc4 100644 --- a/frontend-modern/src/features/alerts/AlertDeliveryHealthCard.test.tsx +++ b/frontend-modern/src/features/alerts/AlertDeliveryHealthCard.test.tsx @@ -1,5 +1,6 @@ import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library'; import { Route, Router } from '@solidjs/router'; +import { createSignal } from 'solid-js'; import { afterEach, describe, expect, it, vi } from 'vitest'; import type { NotificationQueueHealth } from '@/api/notifications'; @@ -123,6 +124,51 @@ describe('AlertDeliveryHealthCard', () => { expect(screen.getByRole('alert')).toBeTruthy(); }); + it('replaces stale failure advice when status becomes unavailable, then restores fresh evidence', () => { + const [unavailable, setUnavailable] = createSignal(false); + render(() => ( + + )); + + expect(screen.getByRole('alert')).toHaveTextContent('classified as authentication (2)'); + setUnavailable(true); + expect(screen.getByRole('alert')).toHaveTextContent('Notification delivery status is unavailable'); + expect(screen.getByRole('alert')).toHaveTextContent('send a test before relying on delivery'); + expect(screen.getByRole('alert')).not.toHaveTextContent('classified as authentication (2)'); + setUnavailable(false); + expect(screen.getByRole('alert')).toHaveTextContent('Notification delivery needs attention'); + expect(screen.getByRole('alert')).toHaveTextContent('classified as authentication (2)'); + expect(screen.getByRole('alert')).not.toHaveTextContent('Notification delivery status is unavailable'); + }); + + it.each(['retry', 'dismiss'] as const)('disables conflicting controls throughout %s and restores them afterwards', (action) => { + const [busy, setBusy] = createSignal(true); + render(() => ( + + )); + + const labels = ['Refresh delivery status', 'Retry retained deliveries', 'Dismiss retained failures']; + for (const name of labels) expect(screen.getByRole('button', { name })).toBeDisabled(); + expect(screen.getByRole('alert')).toHaveTextContent('Notification delivery needs attention'); + setBusy(false); + for (const name of labels) expect(screen.getByRole('button', { name })).toBeEnabled(); + expect(screen.getByRole('alert')).toHaveTextContent('Notification delivery needs attention'); + }); + it('keeps the overview treatment concise and points directly to delivery evidence', () => { render(() => (