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(web): preserve recovery evidence on cancelled confirmation

pulse-triage[bot]5e0c3c467584
diff --git a/frontend-modern/src/features/alerts/__tests__/DestinationsTab.recoveryediting.test.tsx b/frontend-modern/src/features/alerts/__tests__/DestinationsTab.recoveryediting.test.tsx
index f65c6bfac1..ce9ec130c6 100644
--- a/frontend-modern/src/features/alerts/__tests__/DestinationsTab.recoveryediting.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/DestinationsTab.recoveryediting.test.tsx
@@ -189,6 +189,20 @@ describe('DestinationsTab recovery while editing SMTP', () => {
expect(screen.getByText('SMTP fixture rejected')).toBeInTheDocument();
expect(NotificationsAPI.getDeliveryLog).toHaveBeenCalledTimes(1);
+ // Cancelling after a failure must not erase that evidence or start work.
+ vi.mocked(window.confirm).mockReturnValueOnce(false);
+ fireEvent.click(screen.getByRole('button', { name: label }));
+ expect(NotificationsAPI[action]).toHaveBeenCalledTimes(1);
+ expect(NotificationsAPI.getHealth).toHaveBeenCalledTimes(1);
+ expect(NotificationsAPI.getDeliveryLog).toHaveBeenCalledTimes(1);
+ expect(screen.getByRole('button', { name: label })).toBeEnabled();
+ expect(screen.getByRole('status')).toBe(status);
+ expect(status).toHaveTextContent('Unable to ' + verb);
+ expect(editor).toHaveFocus();
+ expect(editor).toHaveValue('unfinished.smtp.example');
+ expect(dirty).not.toHaveBeenCalledWith(false);
+ expect(screen.getByText('SMTP fixture rejected')).toBeInTheDocument();
+
let accept!: (result: { success: boolean; affected: number }) => void;
vi.mocked(NotificationsAPI[action]).mockReturnValueOnce(
new Promise((resolve) => {