title: How to mock a function in jest or prevent default?
body: <p>I am trying to use react-testing-lib to do some integration testing</p>
  
  <p>I want to mock a function like inside my react class called <code>handleSubmit</code></p>
  
  <pre><code>handleSubmit(){
   // does some stuff
   // calls an action creator
  
  }
  </code></pre>
  
  <p>I basically want to stub this method, so that it either returns <code>null</code>/<code>undefined</code> or anything. But I don't want it to actually call the action creator</p>
  
  <p>The reason being I wanted to assert some UI is present and calling the action creator is giving me the error: </p>
  
  <blockquote>
    <p>Actions must be plain objects. Use custom middleware for async actions.</p>
  </blockquote>
  
  <p>I have tried to <code>jest.mock(thismethod)</code> and jest.spyOn()` too but neither seem to work. I just want it to do something like</p>
  
  <pre><code>myFunc() {
  
  }
  </code></pre>
  
  <p>as if it were an empty function and does nothing. How can I stub this?</p>