teamIssuesAge.spec.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import {Organization} from 'sentry-fixture/organization';
  2. import {Team} from 'sentry-fixture/team';
  3. import {render, screen} from 'sentry-test/reactTestingLibrary';
  4. import TeamIssuesAge from 'sentry/views/organizationStats/teamInsights/teamIssuesAge';
  5. describe('TeamIssuesAge', () => {
  6. it('should render graph with table of oldest issues', async () => {
  7. const team = Team();
  8. const organization = Organization();
  9. const timeToResolutionApi = MockApiClient.addMockResponse({
  10. url: `/teams/${organization.slug}/${team.slug}/unresolved-issue-age/`,
  11. body: {
  12. '< 1 hour': 1,
  13. '< 4 hour': 5,
  14. '< 12 hour': 20,
  15. '< 1 day': 80,
  16. '< 1 week': 30,
  17. '< 4 week': 100,
  18. '< 24 week': 50,
  19. '< 1 year': 100,
  20. '> 1 year': 10,
  21. },
  22. });
  23. const issuesApi = MockApiClient.addMockResponse({
  24. url: `/teams/${organization.slug}/${team.slug}/issues/old/`,
  25. body: [TestStubs.Group()],
  26. });
  27. render(<TeamIssuesAge organization={organization} teamSlug={team.slug} />);
  28. // Title
  29. expect(await screen.findByText('RequestError')).toBeInTheDocument();
  30. // Event count
  31. expect(screen.getByText('327k')).toBeInTheDocument();
  32. // User count
  33. expect(screen.getByText('35k')).toBeInTheDocument();
  34. expect(timeToResolutionApi).toHaveBeenCalledTimes(1);
  35. expect(issuesApi).toHaveBeenCalledTimes(1);
  36. });
  37. });