mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-10 18:27:25 +03:00
Improved TagsSelector component test, covering different logic while adding tags
This commit is contained in:
parent
b8a7dccf92
commit
4417a17d5c
1 changed files with 7 additions and 3 deletions
|
@ -49,10 +49,14 @@ describe('<TagsSelector />', () => {
|
|||
]);
|
||||
});
|
||||
|
||||
it('invokes onChange when new tags are added', () => {
|
||||
wrapper.simulate('addition', { name: 'The-New-Tag' });
|
||||
it.each([
|
||||
[ '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([
|
||||
|
|
Loading…
Reference in a new issue