diff --git a/static/app/views/alerts/rules/metric/ruleForm.spec.tsx b/static/app/views/alerts/rules/metric/ruleForm.spec.tsx index c505ae8992d249..ff79f7b016668a 100644 --- a/static/app/views/alerts/rules/metric/ruleForm.spec.tsx +++ b/static/app/views/alerts/rules/metric/ruleForm.spec.tsx @@ -29,6 +29,7 @@ jest.mock('sentry/utils/analytics', () => ({ })), endSpan: jest.fn(), }, + trackAnalytics: jest.fn(), })); describe('Incident Rules Form', () => { @@ -599,6 +600,32 @@ describe('Incident Rules Form', () => { ); }); + it('edits query', async () => { + createWrapper({ + name: 'Query Rule', + projects: ['project-slug'], + eventTypes: ['num_errors'], + thresholdPeriod: 10, + query: 'is:unresolved', + rule, + ruleId: rule.id, + }); + + await userEvent.type(screen.getByTestId('query-builder-input'), 'has:http.url'); + await userEvent.type(screen.getByTestId('query-builder-input'), '{enter}'); + + await userEvent.click(screen.getByLabelText('Save Rule')); + + expect(editRule).toHaveBeenLastCalledWith( + expect.anything(), + expect.objectContaining({ + data: expect.objectContaining({ + query: 'has:http.url', + }), + }) + ); + }); + it('switches from percent change to count', async () => { createWrapper({ ruleId: rule.id,