1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/frontend/src/component/changeRequest/UpdateCount.test.tsx
Nuno Góis b496990f79
chore: add no unused imports biome rule (#5855)
Adds a Biome rule for "no unused imports", which is something we
sometimes have trouble catching.

We're adding this as a warning for now. It is safely and easily fixable
with `yarn lint:fix`.


![image](https://github.com/Unleash/unleash/assets/14320932/fd84dea8-6b20-4ba5-bfd8-047b9dcf2bff)

![image](https://github.com/Unleash/unleash/assets/14320932/990bb0b0-760a-4c5e-8136-d957e902bf0b)
2024-01-11 12:44:05 +00:00

25 lines
942 B
TypeScript

import { render } from 'utils/testRenderer';
import { UpdateCount } from './UpdateCount';
import { screen } from '@testing-library/react';
test('Show only features count when no segments', async () => {
render(<UpdateCount featuresCount={1} segmentsCount={0} />);
expect(screen.getByText('1 feature toggle')).toBeInTheDocument();
expect(screen.queryByText('0 segments')).not.toBeInTheDocument();
});
test('Show features and segments count', async () => {
render(<UpdateCount featuresCount={0} segmentsCount={1} />);
expect(screen.getByText('0 feature toggles')).toBeInTheDocument();
expect(screen.getByText('1 segment')).toBeInTheDocument();
});
test('Show features and segments plural count', async () => {
render(<UpdateCount featuresCount={2} segmentsCount={3} />);
expect(screen.getByText('2 feature toggles')).toBeInTheDocument();
expect(screen.getByText('3 segments')).toBeInTheDocument();
});