projectReplays.spec.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import {ProjectFixture} from 'sentry-fixture/project';
  2. import {initializeOrg} from 'sentry-test/initializeOrg';
  3. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  4. import ProjectReplays from 'sentry/views/settings/project/projectReplays';
  5. describe('ProjectReplays', function () {
  6. const {routerProps, organization, project, router} = initializeOrg();
  7. const url = `/projects/${organization.slug}/${project.slug}/`;
  8. beforeEach(function () {
  9. MockApiClient.clearMockResponses();
  10. MockApiClient.addMockResponse({
  11. url,
  12. method: 'GET',
  13. body: ProjectFixture(),
  14. });
  15. MockApiClient.addMockResponse({
  16. url: `${url}keys/`,
  17. method: 'GET',
  18. body: [],
  19. });
  20. });
  21. it('can toggle rage click issue creation', async function () {
  22. render(
  23. <ProjectReplays {...routerProps} organization={organization} project={project} />,
  24. {
  25. router,
  26. }
  27. );
  28. const mock = MockApiClient.addMockResponse({
  29. url,
  30. method: 'PUT',
  31. });
  32. await userEvent.click(
  33. screen.getByRole('checkbox', {name: 'Create Rage Click Issues'})
  34. );
  35. expect(mock).toHaveBeenCalledWith(
  36. url,
  37. expect.objectContaining({
  38. method: 'PUT',
  39. data: {
  40. options: {'sentry:replay_rage_click_issues': true},
  41. },
  42. })
  43. );
  44. });
  45. });