mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 09:30:31 +03:00
Created Tags test
This commit is contained in:
parent
73a3d1d50f
commit
5162fa2a13
1 changed files with 22 additions and 0 deletions
22
test/short-urls/helpers/Tags.test.tsx
Normal file
22
test/short-urls/helpers/Tags.test.tsx
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
import { render, screen } from '@testing-library/react';
|
||||||
|
import { Tags } from '../../../src/short-urls/helpers/Tags';
|
||||||
|
import { colorGeneratorMock } from '../../utils/services/__mocks__/ColorGenerator.mock';
|
||||||
|
|
||||||
|
describe('<Tags />', () => {
|
||||||
|
const setUp = (tags: string[]) => render(<Tags tags={tags} colorGenerator={colorGeneratorMock} />);
|
||||||
|
|
||||||
|
it('returns no tags when the list is empty', () => {
|
||||||
|
setUp([]);
|
||||||
|
expect(screen.getByText('No tags')).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
[['foo', 'bar', 'baz']],
|
||||||
|
[['one', 'two', 'three', 'four', 'five']],
|
||||||
|
])('returns expected tags based on provided list', (tags) => {
|
||||||
|
setUp(tags);
|
||||||
|
|
||||||
|
expect(screen.queryByText('No tags')).not.toBeInTheDocument();
|
||||||
|
tags.forEach((tag) => expect(screen.getByText(tag)).toBeInTheDocument());
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in a new issue