teamUnresolvedIssues.spec.tsx 1.9 KB

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