diffModal.spec.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import styled from '@emotion/styled';
  2. import {ProjectFixture} from 'sentry-fixture/project';
  3. import {render} from 'sentry-test/reactTestingLibrary';
  4. import DiffModal from 'sentry/components/modals/diffModal';
  5. describe('DiffModal', function () {
  6. it('renders', function () {
  7. const project = ProjectFixture();
  8. MockApiClient.addMockResponse({
  9. url: '/issues/123/events/latest/',
  10. body: {
  11. eventID: '456',
  12. },
  13. });
  14. MockApiClient.addMockResponse({
  15. url: '/projects/123/project-slug/events/456/',
  16. body: [],
  17. });
  18. MockApiClient.addMockResponse({
  19. url: '/issues/234/events/latest/',
  20. body: {
  21. eventID: '789',
  22. },
  23. });
  24. MockApiClient.addMockResponse({
  25. url: '/projects/123/project-slug/events/789/',
  26. body: [],
  27. });
  28. const styledWrapper = styled(c => c.children);
  29. render(
  30. <DiffModal
  31. orgId="123"
  32. baseIssueId="123"
  33. targetIssueId="234"
  34. project={project}
  35. Footer={styledWrapper()}
  36. Body={styledWrapper()}
  37. Header={c => <span>{c.children}</span>}
  38. CloseButton={({children}) => <div>{children}</div>}
  39. closeModal={() => {}}
  40. location={{
  41. pathname: '',
  42. query: {cursor: '0:1:1', statsPeriod: '14d'},
  43. search: '',
  44. hash: '',
  45. state: null,
  46. action: 'PUSH',
  47. key: 'default',
  48. }}
  49. />
  50. );
  51. });
  52. });