moduleUpsellHookWrapper.spec.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import {OrganizationFixture} from 'sentry-fixture/organization';
  2. import {render, screen} from 'sentry-test/reactTestingLibrary';
  3. import {ModuleBodyUpsellHook} from 'sentry/views/insights/common/components/moduleUpsellHookWrapper';
  4. import {ModuleName} from 'sentry/views/insights/types';
  5. jest.mock('sentry/utils/usePageFilters');
  6. describe('ModulePageProviders', () => {
  7. afterEach(() => {
  8. jest.resetAllMocks();
  9. });
  10. it('renders no feature if module is not enabled', async () => {
  11. render(
  12. <ModuleBodyUpsellHook moduleName={ModuleName.DB}>
  13. <div>Module Content</div>
  14. </ModuleBodyUpsellHook>,
  15. {
  16. organization: OrganizationFixture({
  17. features: ['insights-entry-points'],
  18. }),
  19. }
  20. );
  21. await screen.findByText(`You don't have access to this feature`);
  22. });
  23. it('renders module content if module is enabled', async () => {
  24. render(
  25. <ModuleBodyUpsellHook moduleName={ModuleName.DB}>
  26. <div>Module Content</div>
  27. </ModuleBodyUpsellHook>,
  28. {
  29. organization: OrganizationFixture({
  30. features: ['insights-initial-modules'],
  31. }),
  32. }
  33. );
  34. await screen.findByText(`Module Content`);
  35. });
  36. });