title: How do I change the mock implementation of a function in a mock module in Jest
body: <p>I have a utils file that looks something like this</p>
  <pre><code>// utils.js
  const getNextDate = (startDate) =&gt; moment(startDate, 'MMM Do YYYY').startOf('day').add(10, 'days').format('MMM Do YYYY');
  const getDisplayName = (user) =&gt; {
    if (user.type === 'admin') {
      return 'Admin';
    } else if (user.type === 'guest') {
      return 'Guest'
    } else if(user.type === 'user') {
      return `${user.firstname} ${user.lastname}`
    } else {
      return 'No user'
    }
  }
  
  export {
    getNextDate,
    getDisplayName
  }
  </code></pre>
  <p>I also have a mock of my utils file in my <strong>mocks</strong> folder where I implement the mock return values for testing. It looks something like this</p>
  <pre><code>// mock/utils.js
  export const getNextDate = () =&gt; 'Oct 20th 2020';
  export const getDisplayName = (user) =&gt; user
  </code></pre>
  <p>In my component and test, I'm doing something like this</p>
  <pre><code>//Component.js
  import React from 'react';
  import { getNextDate, getDisplayName } from './utils'
  
  export const Component = () =&gt; {
    const user = {
      type: 'admin',
      firstname: 'john',
      lastname: 'doe',
    }
    return (
      &lt;div&gt;
        &lt;div&gt;{getDisplayName(user)}&lt;/div&gt;
        &lt;div&gt;{getNextDate(moment())}&lt;/div&gt;      
      &lt;/div&gt;
    )
  }
  
  // Component.test.js
  import { Component } from '../Component'
  jest.mock('./utils', () =&gt; require('./mock/utils'));
  
  describe('Component', () =&gt; {
    beforeEach(() =&gt; {
      wrapper = shallow(
        &lt;Component /&gt;
      );
    });
  
    it('renders next date', () =&gt; {
        // At this point, I want to change the mock return value of getNextDate to Dec 25th 2020 without changing it in mock/utils.js as other tests are using that value
        expect(wrapper.find('.date').text()).toEqual('Dec 25th 2020');
    });
  });
  </code></pre>
  <p>However, in one of the test cases, I'm trying to change the mock implementation of <code>getNextDate</code>. How do I get this done since I can't just call <code>getNextDate.mockImplementation()</code> directly?</p>