From f5d2c5d143f586da660e134976bd833832834936 Mon Sep 17 00:00:00 2001 From: "pulse-triage[bot]" <249995291+pulse-triage[bot]@users.noreply.github.com> Date: Mon, 7 Sep 2026 18:42:02 +0100 Subject: [PATCH] test(web): guard unsaved state during delivery recovery Assert rejected and accepted retry/dismiss never clear the dirty flag after an SMTP edit; retained input value alone does not prove unsaved-state preservation. Change-source: pulse-maintainer --- .../alerts/__tests__/DestinationsTab.recoveryediting.test.tsx | 3 +++ 1 file changed, 3 insertions(+) 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 39d6a8be2..f65c6bfac 100644 --- a/frontend-modern/src/features/alerts/__tests__/DestinationsTab.recoveryediting.test.tsx +++ b/frontend-modern/src/features/alerts/__tests__/DestinationsTab.recoveryediting.test.tsx @@ -168,6 +168,7 @@ describe('DestinationsTab recovery while editing SMTP', () => { const editor = screen.getByRole('textbox', { name: 'SMTP server' }); fireEvent.input(editor, { target: { value: 'unfinished.smtp.example' } }); expect(dirty).toHaveBeenCalledWith(true); + dirty.mockClear(); const status = screen.getByRole('status'); let reject!: (error: Error) => void; @@ -184,6 +185,7 @@ describe('DestinationsTab recovery while editing SMTP', () => { expect(editor).toHaveFocus(); expect(editor).toHaveValue('unfinished.smtp.example'); expect(emailConfig().server).toBe('unfinished.smtp.example'); + expect(dirty).not.toHaveBeenCalledWith(false); expect(screen.getByText('SMTP fixture rejected')).toBeInTheDocument(); expect(NotificationsAPI.getDeliveryLog).toHaveBeenCalledTimes(1); @@ -212,6 +214,7 @@ describe('DestinationsTab recovery while editing SMTP', () => { expect(editor).toHaveFocus(); expect(editor).toHaveValue('unfinished.smtp.example'); expect(emailConfig().server).toBe('unfinished.smtp.example'); + expect(dirty).not.toHaveBeenCalledWith(false); expect(screen.getByRole('status')).toBe(status); expect(status).toBeEmptyDOMElement(); expect(screen.getByText('SMTP fixture rejected')).toBeInTheDocument();