I am getting the following error
ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was
object.
This error is encountered while I am trying to mock certain modules
My Main.test.js file
import React from 'react';
import { shallow } from 'enzyme';
jest.mock('../Elements', () =>
jest.fn().mockReturnValue({
SortIndicator: (props) => <div {...props}></div>,
ExchangeRate: (props) => <div {...props}></div>,
})
);
jest.mock('../../components/Default_Import', (props) => (
<div {...props}></div>
));
it('IT246 SearchListView is rendering without any error', async () => {
const MainContainer = await import('./MainContainer');
const wrapper = shallow(<MainContainer />)
})
My Main.js file
import { SortIndicator, ExchangeRate } from '../Elements';
export default class SearchListView extends React.Component {
render() {
return (
<>
<SortIndicator></SortIndicator>
<ExchangeRate></ExchangeRate>
</>
)
}
}