teamIssuesBreakdown.spec.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import {Organization} from 'sentry-fixture/organization';
  2. import {TeamIssuesBreakdown as TeamIssuesBreakdownFixture} from 'sentry-fixture/teamIssuesBreakdown';
  3. import {render, screen} from 'sentry-test/reactTestingLibrary';
  4. import TeamIssuesBreakdown from 'sentry/views/organizationStats/teamInsights/teamIssuesBreakdown';
  5. describe('TeamIssuesBreakdown', () => {
  6. it('should render graph with table of issues reviewed', async () => {
  7. const team = TestStubs.Team();
  8. const project = TestStubs.Project({id: '2', slug: 'javascript'});
  9. const organization = Organization();
  10. const teamIssuesActions = MockApiClient.addMockResponse({
  11. url: `/teams/${organization.slug}/${team.slug}/issue-breakdown/`,
  12. body: TeamIssuesBreakdownFixture(),
  13. });
  14. const statuses = ['new', 'regressed', 'unignored'];
  15. render(
  16. <TeamIssuesBreakdown
  17. organization={organization}
  18. projects={[project]}
  19. teamSlug={team.slug}
  20. period="8w"
  21. statuses={['new', 'regressed', 'unignored']}
  22. />
  23. );
  24. for (const status of statuses) {
  25. expect(screen.getByText(status)).toBeInTheDocument();
  26. }
  27. expect(await screen.findByText('javascript')).toBeInTheDocument();
  28. // Total
  29. expect(screen.getByText('49')).toBeInTheDocument();
  30. // Reviewed
  31. expect(screen.getAllByText('30')).toHaveLength(statuses.length);
  32. expect(teamIssuesActions).toHaveBeenCalledTimes(1);
  33. });
  34. });