installWizard.spec.jsx 2.3 KB

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