123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import {fireEvent, render, screen} from 'sentry-test/reactTestingLibrary';
- import FeatureDisabled from 'sentry/components/acl/featureDisabled';
- describe('FeatureDisabled', function () {
- it('renders', function () {
- render(
- <FeatureDisabled
- features={['organization:my-features']}
- featureName="Some Feature"
- />
- );
- expect(
- screen.getByText('This feature is not enabled on your Sentry installation.')
- ).toBeInTheDocument();
- expect(screen.getByText('Help')).toBeInTheDocument();
- });
- it('renders with custom message', function () {
- const customMessage = 'custom message';
- render(
- <FeatureDisabled
- message={customMessage}
- features={['organization:my-features']}
- featureName="Some Feature"
- />
- );
- expect(screen.getByText(customMessage)).toBeInTheDocument();
- });
- it('renders with custom alert component', function () {
- const customAlert = jest.fn().mockReturnValue(null);
- render(
- <FeatureDisabled
- alert={customAlert}
- features={['organization:my-features']}
- featureName="Some Feature"
- />
- );
- expect(customAlert).toHaveBeenCalled();
- });
- it('displays instructions when help is clicked', function () {
- render(
- <FeatureDisabled
- alert
- features={['organization:my-features']}
- featureName="Some Feature"
- />
- );
- fireEvent.click(
- screen.getByText('This feature is not enabled on your Sentry installation.')
- );
- expect(
- screen.getByText(/Enable this feature on your sentry installation/)
- ).toBeInTheDocument();
- });
- });
|