mirror of
https://github.com/techno-tim/littlelink-server.git
synced 2024-11-22 05:25:13 +01:00
fix(Share): Added mock for font-awesome for unit tests
This commit is contained in:
parent
5b3bf5df36
commit
b3fb338ad7
5
src/__mocks__/@fortawesome/react-fontawesome.js
vendored
Normal file
5
src/__mocks__/@fortawesome/react-fontawesome.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import React from 'react';
|
||||
|
||||
export function FontAwesomeIcon(props) {
|
||||
return <i className="fa" />;
|
||||
}
|
@ -18,7 +18,7 @@ function Share(props) {
|
||||
return (
|
||||
<>
|
||||
<a className={'button'} rel="noopener noreferrer" onClick={handleSharing}>
|
||||
<FontAwesomeIcon className="icon" icon="fas fa-share-nodes" />
|
||||
<FontAwesomeIcon className="icon" icon={['fas', 'fa-share-nodes']} />
|
||||
</a>
|
||||
</>
|
||||
);
|
||||
|
@ -1,12 +1,12 @@
|
||||
import Share from '../Share';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import renderer from 'react-test-renderer';
|
||||
import { render } from 'react-dom';
|
||||
|
||||
describe('<Share />', () => {
|
||||
test('renders without exploding', () => {
|
||||
const div = document.createElement('div');
|
||||
ReactDOM.render(<Share />, div);
|
||||
render(<Share />, div);
|
||||
});
|
||||
test('<Share /> snapshot', () => {
|
||||
const tree = renderer.create(<Share />).toJSON();
|
||||
|
@ -5,5 +5,9 @@ exports[`<Share /> <Share /> snapshot 1`] = `
|
||||
className="button"
|
||||
onClick={[Function]}
|
||||
rel="noopener noreferrer"
|
||||
/>
|
||||
>
|
||||
<i
|
||||
className="fa"
|
||||
/>
|
||||
</a>
|
||||
`;
|
||||
|
Loading…
Reference in New Issue
Block a user