From 0af72aa11285d5110862b176ebb20d5a88b61650 Mon Sep 17 00:00:00 2001 From: "pulse-triage[bot]" <249995291+pulse-triage[bot]@users.noreply.github.com> Date: Sat, 5 Sep 2026 03:18:20 +0100 Subject: [PATCH] test(web): cover TrueNAS recovery with another incident active The existing recovery test empties the whole table, which can mask stale expanded detail while monitoring continues. Keep a second disk incident active and verify recovery removes only the old detail and the remaining incident opens with its own resource identity. Change-source: pulse-maintainer --- .../__tests__/TrueNASAlertsTable.test.tsx | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/frontend-modern/src/features/truenas/__tests__/TrueNASAlertsTable.test.tsx b/frontend-modern/src/features/truenas/__tests__/TrueNASAlertsTable.test.tsx index 02bf33842..ce6e492cc 100644 --- a/frontend-modern/src/features/truenas/__tests__/TrueNASAlertsTable.test.tsx +++ b/frontend-modern/src/features/truenas/__tests__/TrueNASAlertsTable.test.tsx @@ -86,6 +86,48 @@ describe('TrueNASAlertsTable', () => { expect(screen.queryByText('Device /dev/sdc has failed.')).not.toBeInTheDocument(); }); + it('removes recovered details without hiding another active incident', async () => { + const disk = makeDisk(); + const otherDisk = makeDisk({ + id: 'disk-sdd', + name: 'sdd', + displayName: 'sdd', + incidents: [ + { + ...disk.incidents![0], + summary: 'Device /dev/sdd has SMART test failures.', + }, + ], + }); + const [resources, setResources] = createSignal([disk, otherDisk]); + render(() => ( + } + emptyTitle="No alerts" + emptyDescription="No active provider incidents" + showToolbar={false} + /> + )); + + await fireEvent.click(screen.getByText('Device /dev/sdc has SMART test failures.')); + expect( + within(screen.getByTestId('truenas-alert-detail')).getByText('disk-sdc'), + ).toBeInTheDocument(); + + setResources([makeDisk({ status: 'healthy', incidents: [] }), otherDisk]); + expect(await screen.findByText('Device /dev/sdd has SMART test failures.')).toBeInTheDocument(); + expect(screen.queryByTestId('truenas-alert-detail')).not.toBeInTheDocument(); + expect(screen.queryByText('Device /dev/sdc has SMART test failures.')).not.toBeInTheDocument(); + expect(screen.queryByText('No active provider incidents')).not.toBeInTheDocument(); + + await fireEvent.click(screen.getByText('Device /dev/sdd has SMART test failures.')); + const detail = within(screen.getByTestId('truenas-alert-detail')); + expect(detail.getByText('disk-sdd')).toBeInTheDocument(); + expect(detail.queryByText('disk-sdc')).not.toBeInTheDocument(); + }); + it('opens inline native alert details for TrueNAS incident rows', async () => { const disk = makeDisk(); const incidents = buildTrueNASIncidentRows([disk]);