index.spec.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import {initializeOrg} from 'sentry-test/initializeOrg';
  2. import {render, screen} from 'sentry-test/reactTestingLibrary';
  3. import ConfigStore from 'sentry/stores/configStore';
  4. import RelocationOnboardingContainer from './index';
  5. describe('Relocation Onboarding Container', function () {
  6. it('should render if feature enabled', function () {
  7. const {routerProps, routerContext, organization} = initializeOrg({
  8. router: {
  9. params: {step: '1'},
  10. },
  11. });
  12. ConfigStore.set('features', new Set(['relocation:enabled']));
  13. render(<RelocationOnboardingContainer {...routerProps} />, {
  14. context: routerContext,
  15. organization,
  16. });
  17. expect(
  18. screen.queryByText("You don't have access to this feature")
  19. ).not.toBeInTheDocument();
  20. });
  21. it('should not render if feature disabled', async function () {
  22. const {routerProps, routerContext, organization} = initializeOrg({
  23. router: {
  24. params: {step: '1'},
  25. },
  26. });
  27. ConfigStore.set('features', new Set([]));
  28. render(<RelocationOnboardingContainer {...routerProps} />, {
  29. context: routerContext,
  30. organization,
  31. });
  32. expect(
  33. await screen.queryByText("You don't have access to this feature")
  34. ).toBeInTheDocument();
  35. });
  36. });