There should be an easy way to do this, but I cannot find the documentary syntax anywhere. I have a React component with a prop that I would like to mock Jest as follows:
jest.mock('./common/MultiSelect', 'MultiSelect');
This works, except that I end up with a React warning cluttering my test results:
Warning: Unknown scroll options by tag. Remove this support from the element.
The component that I am mocking has the prop option, and I really donβt care how it is done, since I can mock it so that it does not give a warning? I tried using React.createElement in mock and returned an array with the name of the element and the arguments of props to the end.
The component I want to make fun of is used as follows:
<MultiSelect options={['option 1', 'option 2']} />
source share