title: Jest - mockReturnValue
body: <p>I have a function which I'm trying to add unit tests for.</p>
  
  <p><strong>Function</strong></p>
  
  <pre><code>    async getStuff() {
         const { foo } = this.props.data;
         const { bar } = this.state;
         const { bazz } = this.props;
  
         const { x, y } = await helpers.getStuffFromServer(foo, bar, bazz);
  
         this.setState({ x, y });
      }
  </code></pre>
  
  <p><strong>Test</strong></p>
  
  <pre><code>    it('should get stuff &amp; set state', async() =&gt; {
         const returnObject = {
             x: dummyData.x,
             y: dummyData.y
         };
         getStuff.mockReturnValue(() =&gt; returnObject);
         const fakeBazz = jest.fn();
         const wrapper = setup({ bazz: fakeBazz });
         wrapper.instance().componentDidMount();
         await expect(getStuff).toBeCalledWith(dummyData.foo, bar, fakeBazz);
         console.log(wrapper.state());
  });
  </code></pre>
  
  <p>My <code>expect</code> assertion works and correct asserts that <code>getStuff</code> was called with the correct values. But <code>getStuff</code> returns 2 x objects <code>x</code> &amp; <code>y</code> - which it uses to <code>setState</code>. I've tried to mock the return value of <code>getStuff</code>, but these mocked return values are not being set in state. </p>
  
  <p>Am I using <code>mockReturnValue</code> correctly?</p>