|
@@ -29,6 +29,7 @@ describe('AlertRulesList', () => {
|
|
|
const defaultOrg = OrganizationFixture({
|
|
|
access: ['alerts:write'],
|
|
|
});
|
|
|
+
|
|
|
TeamStore.loadInitialData([TeamFixture()], false, null);
|
|
|
let rulesMock!: jest.Mock;
|
|
|
let projectMock!: jest.Mock;
|
|
@@ -61,6 +62,7 @@ describe('AlertRulesList', () => {
|
|
|
}),
|
|
|
],
|
|
|
});
|
|
|
+
|
|
|
projectMock = MockApiClient.addMockResponse({
|
|
|
url: '/organizations/org-slug/projects/',
|
|
|
body: [
|
|
@@ -446,4 +448,43 @@ describe('AlertRulesList', () => {
|
|
|
})
|
|
|
);
|
|
|
});
|
|
|
+
|
|
|
+ it('does not display ACTIVATED Metric Alerts', async () => {
|
|
|
+ rulesMock = MockApiClient.addMockResponse({
|
|
|
+ url: '/organizations/org-slug/combined-rules/',
|
|
|
+ headers: {Link: pageLinks},
|
|
|
+ body: [
|
|
|
+ ProjectAlertRuleFixture({
|
|
|
+ id: '123',
|
|
|
+ name: 'First Issue Alert',
|
|
|
+ projects: ['earth'],
|
|
|
+ createdBy: {name: 'Samwise', id: 1, email: ''},
|
|
|
+ }),
|
|
|
+ MetricRuleFixture({
|
|
|
+ id: '345',
|
|
|
+ projects: ['earth'],
|
|
|
+ name: 'Omitted Test Metric Alert',
|
|
|
+ monitorType: 1,
|
|
|
+ latestIncident: IncidentFixture({
|
|
|
+ status: IncidentStatus.CRITICAL,
|
|
|
+ }),
|
|
|
+ }),
|
|
|
+ MetricRuleFixture({
|
|
|
+ id: '678',
|
|
|
+ name: 'Test Metric Alert 2',
|
|
|
+ monitorType: 0,
|
|
|
+ projects: ['earth'],
|
|
|
+ latestIncident: null,
|
|
|
+ }),
|
|
|
+ ],
|
|
|
+ });
|
|
|
+
|
|
|
+ const {routerContext, organization} = initializeOrg({organization: defaultOrg});
|
|
|
+ render(<AlertRulesList />, {context: routerContext, organization});
|
|
|
+
|
|
|
+ expect(await screen.findByText('Test Metric Alert 2')).toBeInTheDocument();
|
|
|
+ expect(await screen.findByText('First Issue Alert')).toBeInTheDocument();
|
|
|
+
|
|
|
+ expect(screen.queryByText('Omitted Test Metric Alert')).not.toBeInTheDocument();
|
|
|
+ });
|
|
|
});
|