teamIssuesBreakdown.spec.tsx 1.5 KB

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