teamIssuesBreakdown.spec.tsx 1.4 KB

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