teamUnresolvedIssues.spec.tsx 1.8 KB

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