mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-17 21:13:48 +00:00
Improved TagsSelector component test, covering different logic while adding tags
This commit is contained in:
@@ -49,10 +49,14 @@ describe('<TagsSelector />', () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('invokes onChange when new tags are added', () => {
|
it.each([
|
||||||
wrapper.simulate('addition', { name: 'The-New-Tag' });
|
[ 'The-New-Tag', [ ...tags, 'the-new-tag' ]],
|
||||||
|
[ 'comma,separated,tags', [ ...tags, 'comma', 'separated', 'tags' ]],
|
||||||
|
[ 'foo', tags ],
|
||||||
|
])('invokes onChange when new tags are added', (newTag, expectedTags) => {
|
||||||
|
wrapper.simulate('addition', { name: newTag });
|
||||||
|
|
||||||
expect(onChange).toHaveBeenCalledWith([ ...tags, 'the-new-tag' ]);
|
expect(onChange).toHaveBeenCalledWith(expectedTags);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
|
|||||||
Reference in New Issue
Block a user