index.spec.tsx 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import {render, screen} from 'sentry-test/reactTestingLibrary';
  2. import InstallWizard from 'sentry/views/admin/installWizard';
  3. describe('InstallWizard', function () {
  4. beforeEach(function () {
  5. MockApiClient.addMockResponse({
  6. url: '/internal/options/?query=is:required',
  7. body: TestStubs.InstallWizard(),
  8. });
  9. });
  10. afterEach(function () {
  11. MockApiClient.clearMockResponses();
  12. });
  13. it('renders', function () {
  14. render(<InstallWizard onConfigured={jest.fn()} />);
  15. });
  16. it('has no option selected when beacon.anonymous is unset', function () {
  17. MockApiClient.addMockResponse({
  18. url: '/internal/options/?query=is:required',
  19. body: TestStubs.InstallWizard({
  20. 'beacon.anonymous': {
  21. field: {
  22. disabledReason: null,
  23. default: false,
  24. required: true,
  25. disabled: false,
  26. allowEmpty: true,
  27. isSet: false,
  28. },
  29. value: false,
  30. },
  31. }),
  32. });
  33. render(<InstallWizard onConfigured={jest.fn()} />);
  34. expect(
  35. screen.getByRole('radio', {
  36. name: 'Please keep my usage information anonymous',
  37. })
  38. ).not.toBeChecked();
  39. expect(
  40. screen.getByRole('radio', {
  41. name: 'Send my contact information along with usage statistics',
  42. })
  43. ).not.toBeChecked();
  44. });
  45. it('has no option selected even when beacon.anonymous is set', function () {
  46. MockApiClient.addMockResponse({
  47. url: '/internal/options/?query=is:required',
  48. body: TestStubs.InstallWizard({
  49. 'beacon.anonymous': {
  50. field: {
  51. disabledReason: null,
  52. default: false,
  53. required: true,
  54. disabled: false,
  55. allowEmpty: true,
  56. isSet: true,
  57. },
  58. value: false,
  59. },
  60. }),
  61. });
  62. render(<InstallWizard onConfigured={jest.fn()} />);
  63. expect(
  64. screen.getByRole('radio', {
  65. name: 'Please keep my usage information anonymous',
  66. })
  67. ).not.toBeChecked();
  68. expect(
  69. screen.getByRole('radio', {
  70. name: 'Send my contact information along with usage statistics',
  71. })
  72. ).not.toBeChecked();
  73. });
  74. });