2023-08-10 12:01:52 +02:00
|
|
|
import { render } from 'utils/testRenderer';
|
2023-08-11 14:59:59 +02:00
|
|
|
import { UpdateCount } from './UpdateCount';
|
2023-08-10 12:01:52 +02:00
|
|
|
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();
|
|
|
|
});
|