installWizard.spec.jsx 2.3 KB

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