1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-22 01:16:07 +02:00
unleash.unleash/frontend/src/component/common/PremiumFeature/PremiumFeature.test.tsx
2024-11-22 10:04:41 +01:00

56 lines
1.6 KiB
TypeScript

import { render } from 'utils/testRenderer';
import { screen } from '@testing-library/react';
import { PremiumFeature } from './PremiumFeature';
test('Show plans comparison message and link by default - with tooltip', async () => {
render(<PremiumFeature feature='environments' tooltip={true} />);
const link = screen.getByText('Compare plans');
expect(link).toHaveAttribute(
'href',
'https://www.getunleash.io/plans?feature=environments',
);
});
test('Show plans comparison message and link by default - without tooltip', async () => {
render(<PremiumFeature feature='environments' tooltip={false} />);
const link = screen.getByText('Compare plans');
expect(link).toHaveAttribute(
'href',
'https://www.getunleash.io/plans?feature=environments',
);
});
test('Show upgrade message and link - with tooltip', async () => {
render(
<PremiumFeature feature='environments' tooltip={true} mode='upgrade' />,
);
const link = screen.getByText('View our Enterprise offering');
expect(link).toHaveAttribute(
'href',
'https://www.getunleash.io/upgrade_unleash?utm_medium=feature&utm_content=environments',
);
});
test('Show upgrade message and link - without tooltip', async () => {
render(
<PremiumFeature
feature='environments'
tooltip={false}
mode='upgrade'
/>,
);
const link = screen.getByText('View our Enterprise offering');
expect(link).toHaveAttribute(
'href',
'https://www.getunleash.io/upgrade_unleash?utm_medium=feature&utm_content=environments',
);
});