title: Calling Jest spyOn on function passed as props
body: <p>I have an onSubmit function passed as props to a child component.</p>
  
  <p>How would I spy on it? This is one of the things I have tried</p>
  
  <pre><code>const onSubmitMock = jest.fn()
  
    const wrapper = shallow(
      &lt;Form onSubmit={onSubmitMock} /&gt;
    )
  
    const spy = jest.spyOn(wrapper.instance(), onSubmitMock);
  </code></pre>
  
  <p>I get </p>
  
  <p>Cannot spy the function mockConstructor() {return fn.apply(this, arguments);} property because it is not a function; undefined given instead</p>
  
  <p>I tried</p>
  
  <pre><code>const spy = jest.spyOn(wrapper.instance(), 'onSubmit');
  </code></pre>
  
  <p>and the same thing happended.</p>