title: Jest - test method that passes to child component
body: <p>I'm new in testing React component, so I'm trying test some method in parent component that passes to child component as props. I use Jest and Enzyme for this.</p>
  
  <p>My test:</p>
  
  <pre><code>it('should be able to call myMethod callback', () =&gt; {
    const mockFn = jest.fn();
    ParentComponent.prototype.myMethod = mockFn;
  
    const wrapper = Enzyme.shallow(&lt;ParentComponent /&gt;);
    wrapper.find('ChildComponent').props().myMethod();
  
    expect(mockFn).toHaveBeenCalledTimes(1);
  });
  </code></pre>
  
  <p>The test passed but myMethod didn't invoke (myMethod doesn't covered by tests).</p>
  
  <p>When I use:</p>
  
  <pre><code>wrapper.instance().myMethod = mockFn;
  </code></pre>
  
  <p>instead of:</p>
  
  <pre><code>ParentComponent.prototype.myMethod = mockFn;
  </code></pre>
  
  <p>everything is the opposite - myMethod is invoked, but the test is failed with error:</p>
  
  <pre><code>expect(jest.fn()).toHaveBeenCalledTimes(1)
  
  Expected mock function to have been called one time, but it was called zero times.
  </code></pre>
  
  <p>How can I solve this? Thanks in advance.</p>