teamUnresolvedIssues.spec.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 issuesApi = MockApiClient.addMockResponse({
  12. url: `/teams/${organization.slug}/${team.slug}/all-unresolved-issues/`,
  13. body: {
  14. 2: {
  15. '2021-12-10T00:00:00+00:00': {unresolved: 45},
  16. '2021-12-11T00:00:00+00:00': {unresolved: 45},
  17. '2021-12-12T00:00:00+00:00': {unresolved: 45},
  18. '2021-12-13T00:00:00+00:00': {unresolved: 49},
  19. '2021-12-14T00:00:00+00:00': {unresolved: 50},
  20. '2021-12-15T00:00:00+00:00': {unresolved: 45},
  21. '2021-12-16T00:00:00+00:00': {unresolved: 44},
  22. '2021-12-17T00:00:00+00:00': {unresolved: 44},
  23. '2021-12-18T00:00:00+00:00': {unresolved: 44},
  24. '2021-12-19T00:00:00+00:00': {unresolved: 43},
  25. '2021-12-20T00:00:00+00:00': {unresolved: 40},
  26. '2021-12-21T00:00:00+00:00': {unresolved: 37},
  27. '2021-12-22T00:00:00+00:00': {unresolved: 36},
  28. '2021-12-23T00:00:00+00:00': {unresolved: 37},
  29. },
  30. },
  31. });
  32. render(
  33. <TeamUnresolvedIssues
  34. organization={organization}
  35. projects={[project]}
  36. teamSlug={team.slug}
  37. period="14d"
  38. />
  39. );
  40. // Project
  41. expect(await screen.findByText('project-slug')).toBeInTheDocument();
  42. expect(screen.getByText('-14%')).toBeInTheDocument();
  43. expect(issuesApi).toHaveBeenCalledTimes(1);
  44. });
  45. });