teamAlertsTriggered.spec.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import {OrganizationFixture} from 'sentry-fixture/organization';
  2. import {ProjectFixture} from 'sentry-fixture/project';
  3. import {TeamFixture} from 'sentry-fixture/team';
  4. import {TeamAlertsTriggeredFixture} from 'sentry-fixture/teamAlertsTriggered';
  5. import {render} from 'sentry-test/reactTestingLibrary';
  6. import TeamAlertsTriggered from 'sentry/views/organizationStats/teamInsights/teamAlertsTriggered';
  7. describe('TeamAlertsTriggered', () => {
  8. it('should render graph of alerts triggered', () => {
  9. const team = TeamFixture();
  10. const organization = OrganizationFixture();
  11. const project = ProjectFixture();
  12. const alertsTriggeredApi = MockApiClient.addMockResponse({
  13. url: `/teams/${organization.slug}/${team.slug}/alerts-triggered/`,
  14. body: TeamAlertsTriggeredFixture(),
  15. });
  16. MockApiClient.addMockResponse({
  17. url: `/teams/${organization.slug}/${team.slug}/alerts-triggered-index/`,
  18. body: [],
  19. });
  20. render(
  21. <TeamAlertsTriggered
  22. organization={organization}
  23. projects={[project]}
  24. teamSlug={team.slug}
  25. period="8w"
  26. />
  27. );
  28. expect(alertsTriggeredApi).toHaveBeenCalledTimes(1);
  29. });
  30. });