teamUnresolvedIssues.spec.tsx 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import {render, screen} from 'sentry-test/reactTestingLibrary';
  2. import {TeamUnresolvedIssues} from './teamUnresolvedIssues';
  3. describe('TeamUnresolvedIssues', () => {
  4. it('should render graph with table with % change', async () => {
  5. const team = TestStubs.Team();
  6. const project = TestStubs.Project();
  7. const organization = TestStubs.Organization({projects: [project]});
  8. const issuesApi = MockApiClient.addMockResponse({
  9. url: `/teams/${organization.slug}/${team.slug}/all-unresolved-issues/`,
  10. body: {
  11. 2: {
  12. '2021-12-10T00:00:00+00:00': {unresolved: 45},
  13. '2021-12-11T00:00:00+00:00': {unresolved: 45},
  14. '2021-12-12T00:00:00+00:00': {unresolved: 45},
  15. '2021-12-13T00:00:00+00:00': {unresolved: 49},
  16. '2021-12-14T00:00:00+00:00': {unresolved: 50},
  17. '2021-12-15T00:00:00+00:00': {unresolved: 45},
  18. '2021-12-16T00:00:00+00:00': {unresolved: 44},
  19. '2021-12-17T00:00:00+00:00': {unresolved: 44},
  20. '2021-12-18T00:00:00+00:00': {unresolved: 44},
  21. '2021-12-19T00:00:00+00:00': {unresolved: 43},
  22. '2021-12-20T00:00:00+00:00': {unresolved: 40},
  23. '2021-12-21T00:00:00+00:00': {unresolved: 37},
  24. '2021-12-22T00:00:00+00:00': {unresolved: 36},
  25. '2021-12-23T00:00:00+00:00': {unresolved: 37},
  26. },
  27. },
  28. });
  29. render(
  30. <TeamUnresolvedIssues
  31. organization={organization}
  32. projects={organization.projects}
  33. teamSlug={team.slug}
  34. period="14d"
  35. />
  36. );
  37. // Project
  38. expect(await screen.findByText('project-slug')).toBeInTheDocument();
  39. expect(screen.getByText('-14%')).toBeInTheDocument();
  40. expect(issuesApi).toHaveBeenCalledTimes(1);
  41. });
  42. });