index.spec.tsx 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import {InstallWizardFixture} from 'sentry-fixture/installWizard';
  2. import {render, screen} from 'sentry-test/reactTestingLibrary';
  3. import InstallWizard from 'sentry/views/admin/installWizard';
  4. describe('InstallWizard', function () {
  5. beforeEach(function () {
  6. MockApiClient.addMockResponse({
  7. url: '/internal/options/?query=is:required',
  8. body: InstallWizardFixture(),
  9. });
  10. });
  11. afterEach(function () {
  12. MockApiClient.clearMockResponses();
  13. });
  14. it('renders', function () {
  15. render(<InstallWizard onConfigured={jest.fn()} />);
  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: InstallWizardFixture({
  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: InstallWizardFixture({
  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. });