teamIssuesAge.spec.tsx 1.3 KB

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