mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-12-10 14:16:59 -06:00
Improved TagsSelector component test, covering different logic while adding tags
This commit is contained in:
parent
b8a7dccf92
commit
4417a17d5c
@ -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…
x
Reference in New Issue
Block a user