Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

test(alerts): protect delivery log outage recovery presentation

pulse-triage[bot]2bf570bec8af
diff --git a/frontend-modern/src/features/alerts/AlertDeliveryLogCard.test.tsx b/frontend-modern/src/features/alerts/AlertDeliveryLogCard.test.tsx
index c720fec134..723906f962 100644
--- a/frontend-modern/src/features/alerts/AlertDeliveryLogCard.test.tsx
+++ b/frontend-modern/src/features/alerts/AlertDeliveryLogCard.test.tsx
@@ -1,3 +1,4 @@
+import { createSignal } from 'solid-js';
import { cleanup, render, screen } from '@solidjs/testing-library';
import { afterEach, describe, expect, it, vi } from 'vitest';
@@ -204,6 +205,38 @@ describe('AlertDeliveryLogCard', () => {
expect(screen.queryByText(/No alert deliveries were attempted/)).not.toBeInTheDocument();
});
+ it('hides previously loaded rows during an outage and restores fresh results after recovery', () => {
+ const [currentLog, setCurrentLog] = createSignal<NotificationDeliveryLog>(log);
+ const [unavailable, setUnavailable] = createSignal(false);
+ render(() => (
+ <AlertDeliveryLogCard
+ log={currentLog()}
+ unavailable={unavailable()}
+ refreshing={false}
+ onRefresh={vi.fn()}
+ webhooks={webhooks}
+ />
+ ));
+
+ expect(screen.getByText('Ops Discord')).toBeInTheDocument();
+ setUnavailable(true);
+ expect(screen.getByRole('alert')).toHaveTextContent(/could not read the delivery log/);
+ expect(screen.queryByRole('list')).not.toBeInTheDocument();
+ expect(screen.queryByText('Delivered')).not.toBeInTheDocument();
+ expect(screen.queryByText(/No alert deliveries were attempted/)).not.toBeInTheDocument();
+
+ setCurrentLog({ ...log, entries: [log.entries[1]] });
+ setUnavailable(false);
+ expect(screen.queryByRole('alert')).not.toBeInTheDocument();
+ expect(screen.getByText('Delivered')).toBeInTheDocument();
+ expect(screen.queryByText('Ops Discord')).not.toBeInTheDocument();
+ expect(screen.getAllByRole('listitem')).toHaveLength(1);
+
+ setCurrentLog({ ...log, entries: [] });
+ expect(screen.getByText(/No alert deliveries were attempted/)).toBeInTheDocument();
+ expect(screen.queryByRole('list')).not.toBeInTheDocument();
+ });
+
it('reports an unreadable log as unavailable instead of empty', () => {
render(() => (
<AlertDeliveryLogCard