I have added a component which is using function as a child. I had shallow enzyme tests for this component which stopped working.
How can I shallow test a component which is using function as a child?
Component
return (
<I18n>
{({ i18n }) => (
<div />
)}
</I18n>
)
Tests which I have tried
import { shallow } from 'enzyme';
wrapper = shallow(<Component />)
.find('I18n')
.children();
console.log(wrapper.debug()); //outputs: [function]
wrapper = shallow(<Component />)
.find('I18n')
.children()();
// TypeError: (0 , _enzyme.shallow)(...).find(...).children(...) is not a function