title: Test React component method is calling function pass as a prop
body: <p>I want to test that when calling a method from a React component it trigger a function pass to the component as a props.
  The method is something like this:</p>
  
  <pre><code>customMethod() {
    // Do something
  
    this.props.trackEvent({
      category: 'eventCategory',
      action: 'eventAction',
      label: 'eventAction',
    });
  
    // Do something else
  }
  </code></pre>
  
  <p>The method can be called from different ways, so I want just to make a generic test: if customMethod is called, should trigger this.props.trackEvent with data.</p>
  
  <p>Is there a way to trigger a method call using jest and/or enzyme? I've read about doing something like this:</p>
  
  <pre><code>const wrapper = shallow(&lt;AdPage {...baseProps} /&gt;);
  wrapper.instance().customMethod();
  </code></pre>
  
  <p>But it is not working… any ideas.
  I'm pretty new in the testing, so maybe should I use a different approach to this kind of tests?</p>