teamIssuesAge.spec.tsx 1.3 KB

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