teamIssuesBreakdown.spec.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  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', async () => {
  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={['new', 'regressed', 'unignored']}
  20. />
  21. );
  22. for (const status of statuses) {
  23. expect(screen.getByText(status)).toBeInTheDocument();
  24. }
  25. expect(await screen.findByText('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. });