mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-13 11:03:50 +00:00
Created Tags test
This commit is contained in:
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());
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user