title: Jest mock value per test
body: <p>I want to test if a library function is not called when token value is null. To do this I must change mock value of GOOGLE_ANALYTICS_TRACKING_ID between unit tests. It is stored in 'config.js' which looks like that:</p>
  
  <pre><code>module.exports = {
    GOOGLE_ANALYTICS_TRACKING_ID: process.env.GOOGLE_ANALYTICS_TRACKING_ID
  };
  </code></pre>
  
  <p>Also it is used by withGoogleAnalytics which is a HOC. Inside it I'm importing config this way: </p>
  
  <pre><code>import { GOOGLE_ANALYTICS_TRACKING_ID } from 'config';
  </code></pre>
  
  <p>My test looks like that:</p>
  
  <pre><code>import React from 'react';
  import { shallow } from 'enzyme';
  import ReactGA from 'react-ga';
  
  import withGoogleAnalytics from '../withGoogleAnalytics';
  
  jest.mock('react-ga', () =&gt; ({
    pageview: jest.fn(),
    initialize: jest.fn()
  }));
  
  jest.mock('config', () =&gt; ({ GOOGLE_ANALYTICS_TRACKING_ID: '123' }));
  
  const Component = withGoogleAnalytics(() =&gt; &lt;div /&gt;);
  
  describe('HOC withGoogleAnalytics', () =&gt; {
    describe('render', () =&gt; {
      const shallowWrapper = shallow(&lt;Component /&gt;);
  
      it('should fire initialize action', () =&gt; {
        expect(ReactGA.initialize).toHaveBeenCalledWith('123');
      });
  
      it('should have pageview prop set', () =&gt; {
        expect(shallowWrapper.prop('pageview')).toBe(ReactGA.pageview);
      });
  
      it('should not fire initialize action', () =&gt; {
        expect(ReactGA.initialize).not.toHaveBeenCalled();
      });
    });
  });
  </code></pre>
  
  <p>From what I read on StackOverflow and GitHub I should be able to do it using jest.resetModules() and jest.mockImplementation() but all the examples were mocking functions. Here I need to change string value between tests. How can I do it?</p>