mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-10 18:27:25 +03:00
Created CopyToClipboardIcon test
This commit is contained in:
parent
0fce6dd821
commit
0c9434b555
1 changed files with 27 additions and 0 deletions
27
test/utils/CopyToClipboardIcon.test.tsx
Normal file
27
test/utils/CopyToClipboardIcon.test.tsx
Normal file
|
@ -0,0 +1,27 @@
|
|||
import { shallow, ShallowWrapper } from 'enzyme';
|
||||
import CopyToClipboard from 'react-copy-to-clipboard';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faCopy as copyIcon } from '@fortawesome/free-regular-svg-icons';
|
||||
import { CopyToClipboardIcon } from '../../src/utils/CopyToClipboardIcon';
|
||||
|
||||
describe('<CopyToClipboardIcon />', () => {
|
||||
let wrapper: ShallowWrapper;
|
||||
const onCopy = () => {};
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = shallow(<CopyToClipboardIcon text="foo" onCopy={onCopy} />);
|
||||
});
|
||||
afterEach(() => wrapper?.unmount());
|
||||
|
||||
test('expected components are wrapped', () => {
|
||||
const copyToClipboard = wrapper.find(CopyToClipboard);
|
||||
const icon = wrapper.find(FontAwesomeIcon);
|
||||
|
||||
expect(copyToClipboard).toHaveLength(1);
|
||||
expect(copyToClipboard.prop('text')).toEqual('foo');
|
||||
expect(copyToClipboard.prop('onCopy')).toEqual(onCopy);
|
||||
expect(icon).toHaveLength(1);
|
||||
expect(icon.prop('icon')).toEqual(copyIcon);
|
||||
expect(icon.prop('className')).toEqual('ml-2 copy-to-clipboard-icon');
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue