Running a Jest test in Typescript
test.tsx
it('should render Facebook Icon in Footer', () => {
const wrapper = mount(<Footer />);
const renderedProps = wrapper.find('FontAwesomeIcon').at(0).props();
console.log('rendered props: ', renderedProps); // LOGS OUT
console.log('rendered props icon: ', renderedProps.icon); // ERRORS
});
logged out rendered props looks like this:
rendered props: {
onClick: [Function: onClick],
icon: [Function], // ICON IS VERY CLEARLY THERE.
size: 'xs'
}
Instead I get this error:
Property 'icon' does not exist on type 'HTMLAttributes'.
I'm very new to Typescript. Wondering if I'm supposed to overwrite the type somehow?
I just want to run checks on the props that are being passed to my mock <FontAwesomeIcon />
Help?