eventsTable.spec.jsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import {render, screen} from 'sentry-test/reactTestingLibrary';
  2. import EventsTable from 'sentry/components/eventsTable/eventsTable';
  3. jest.mock('sentry/utils/useRoutes', () => ({
  4. useRoutes: jest.fn(() => []),
  5. }));
  6. describe('EventsTable', function () {
  7. it('renders', function () {
  8. const {container} = render(
  9. <EventsTable
  10. tagList={[]}
  11. orgId="orgId"
  12. projectId="projectId"
  13. groupId="groupId"
  14. orgFeatures={[]}
  15. events={TestStubs.DetailedEvents()}
  16. />
  17. );
  18. expect(container).toSnapshot();
  19. });
  20. it('removes the replay column when the feature is disabled', () => {
  21. render(
  22. <EventsTable
  23. tagList={[
  24. {
  25. key: 'replayId',
  26. name: 'Replayid',
  27. totalValues: 5,
  28. },
  29. ]}
  30. orgId="orgId"
  31. projectId="projectId"
  32. groupId="groupId"
  33. orgFeatures={[]}
  34. events={TestStubs.DetailedEvents()}
  35. />
  36. );
  37. expect(screen.queryByRole('columnheader', {name: 'Replay'})).not.toBeInTheDocument();
  38. });
  39. it('renders the replay column when the feature is enabled', () => {
  40. render(
  41. <EventsTable
  42. tagList={[
  43. {
  44. key: 'replayId',
  45. name: 'Replayid',
  46. totalValues: 5,
  47. },
  48. ]}
  49. orgId="orgId"
  50. projectId="projectId"
  51. groupId="groupId"
  52. orgFeatures={['session-replay-ui']}
  53. events={TestStubs.DetailedEvents()}
  54. />
  55. );
  56. expect(screen.getByRole('columnheader', {name: 'Replay'})).toBeVisible();
  57. });
  58. });