teamUnresolvedIssues.spec.tsx 1.8 KB

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