I am not able to test a function defined in parent class and invoked in child class. This is the link to my code- https://codesandbox.io/s/testing-parent-child-enzyme-stx7el?file=/src/App.js
This is my test code-
it('testing CTA btn click', () => {
const component = mount(<Parent {...parentProps}/>);
const element = component.findByProps({ className: 'cta-btn' })[0];
element.props.onClick();
setTimeout(()=> {
expect(element.props.btnClick).toHaveBeenCalled();
},1000);
})
But I am getting error as
No instances found with props {"className":"cta-btn"}
Please help.