teamIssuesBreakdown.spec.jsx 1.2 KB

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