projectUserFeedback.spec.jsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import {initializeOrg} from 'sentry-test/initializeOrg';
  2. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  3. import ProjectUserFeedback from 'sentry/views/settings/project/projectUserFeedback';
  4. describe('ProjectUserFeedback', function () {
  5. const {org, project, routerContext} = initializeOrg();
  6. const url = `/projects/${org.slug}/${project.slug}/`;
  7. beforeEach(function () {
  8. MockApiClient.clearMockResponses();
  9. MockApiClient.addMockResponse({
  10. url,
  11. method: 'GET',
  12. body: TestStubs.Project(),
  13. });
  14. MockApiClient.addMockResponse({
  15. url: `${url}keys/`,
  16. method: 'GET',
  17. body: [],
  18. });
  19. });
  20. it('can toggle sentry branding option', function () {
  21. render(
  22. <ProjectUserFeedback
  23. organizatigon={org}
  24. project={project}
  25. params={{orgId: org.slug, projectId: project.slug}}
  26. />,
  27. {context: routerContext}
  28. );
  29. const mock = MockApiClient.addMockResponse({
  30. url,
  31. method: 'PUT',
  32. });
  33. // Click Regenerate Token
  34. userEvent.click(screen.getByRole('checkbox', {name: 'Show Sentry Branding'}));
  35. expect(mock).toHaveBeenCalledWith(
  36. url,
  37. expect.objectContaining({
  38. method: 'PUT',
  39. data: {
  40. options: {'feedback:branding': true},
  41. },
  42. })
  43. );
  44. });
  45. });