title: How test callback click in child component that was passed from parent component?
body: <p>I have the following parent component:</p>
  
  <pre><code>import React, { Fragment } from 'react';
  
  export class Parent extends Component {
    constructor(props) {
      super(props);
      this.state = {
        show: false,
      };
    }
  
    onClick = () =&gt; {
      // working
    }
  
    render() {
  
      return (
        &lt;Fragment&gt;
          &lt;Child handleClick={this.onClick} /&gt;
        &lt;/Fragment&gt;
      );
    }
  }
  </code></pre>
  
  <p>I need to check if callback fired in Child component, onClick method will be fired in Parent component.
  I wrote such a test:</p>
  
  <pre><code>test("check callback fire", () =&gt; {
      let mockFn = jest.fn();
      Parent.prototype.onClick = mockFn;
  
      let wrapper = shallow(&lt;Parent /&gt;);
  
      wrapper.find('Child').props().handleClick();
  
      expect(mockFn).toHaveBeenCalled();
    });
  </code></pre>
  
  <p>and I got an error</p>
  
  <pre><code> Expected mock function to have been called, but it was not called.
  </code></pre>
  
  <p>How can I do that properly with jest and enzyme? Is it possible?</p>