From cbe2b8561646bb5fdc8c0609b2fa900340eb6510 Mon Sep 17 00:00:00 2001 From: Leander Rodrigues Date: Tue, 25 Mar 2025 11:36:07 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Allow=20name=20in=20test=20notifica?= =?UTF-8?q?tions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/alerts/rules/issue/index.spec.tsx | 24 +++++++++++++++++++ static/app/views/alerts/rules/issue/index.tsx | 1 + 2 files changed, 25 insertions(+) diff --git a/static/app/views/alerts/rules/issue/index.spec.tsx b/static/app/views/alerts/rules/issue/index.spec.tsx index ba5b4a66bd4948..3121ddf5d44382 100644 --- a/static/app/views/alerts/rules/issue/index.spec.tsx +++ b/static/app/views/alerts/rules/issue/index.spec.tsx @@ -193,6 +193,30 @@ describe('IssueRuleEditor', function () { expect(await screen.findByLabelText('Save Rule')).toBeEnabled(); expect(screen.queryByTestId('project-permission-alert')).not.toBeInTheDocument(); }); + + it('allows test notifications', async () => { + const {organization, project} = createWrapper(); + const mockTestNotification = MockApiClient.addMockResponse({ + url: `/projects/${organization.slug}/${project.slug}/rule-actions/`, + method: 'POST', + body: {}, + }); + await userEvent.click(screen.getByText('Send Test Notification')); + expect(mockTestNotification).toHaveBeenCalledWith( + `/projects/${organization.slug}/${project.slug}/rule-actions/`, + expect.objectContaining({ + data: { + actions: [ + { + id: 'sentry.rules.actions.notify_event.NotifyEventAction', + name: 'Send a notification (for all legacy integrations)', + }, + ], + name: 'My alert rule', + }, + }) + ); + }); }); describe('Edit Rule', function () { diff --git a/static/app/views/alerts/rules/issue/index.tsx b/static/app/views/alerts/rules/issue/index.tsx index 37786c2b5709f3..8361b783a4df5b 100644 --- a/static/app/views/alerts/rules/issue/index.tsx +++ b/static/app/views/alerts/rules/issue/index.tsx @@ -433,6 +433,7 @@ class IssueRuleEditor extends DeprecatedAsyncComponent { method: 'POST', data: { actions: rule?.actions ?? [], + name: rule?.name, }, }) .then(() => {