teamIssuesBreakdown.spec.tsx 1.4 KB

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