index.spec.tsx 2.2 KB

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