mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 17:40:23 +03:00
27 lines
1 KiB
TypeScript
27 lines
1 KiB
TypeScript
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());
|
|
|
|
it('wraps expected components', () => {
|
|
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('ms-2 copy-to-clipboard-icon');
|
|
});
|
|
});
|