fix(Share): Added mock for font-awesome for unit tests

This commit is contained in:
Timothy Stewart 2023-02-13 22:22:05 -06:00
parent 5b3bf5df36
commit b3fb338ad7
4 changed files with 13 additions and 4 deletions

View File

@ -0,0 +1,5 @@
import React from 'react';
export function FontAwesomeIcon(props) {
return <i className="fa" />;
}

View File

@ -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>
</>
);

View File

@ -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();

View File

@ -5,5 +5,9 @@ exports[`<Share /> <Share /> snapshot 1`] = `
className="button"
onClick={[Function]}
rel="noopener noreferrer"
/>
>
<i
className="fa"
/>
</a>
`;