title: Is there a way to properly mock Reselect selectors for unit testing?
body: <p>I'm having a pretty complex selectors structure in my project (some selectors may have up to 5 levels of nesting) so some of them are very hard to test with passing input state and I would like to mock input selectors instead. However I found that this is not really possible.</p>
  
  <p>Here is the most simple example:</p>
  
  <pre><code>// selectors1.js
  export const baseSelector = createSelector(...);
  </code></pre>
  
  <p>-</p>
  
  <pre><code>// selectors2.js
  export const targetSelector = createSelector([selectors1.baseSelector], () =&gt; {...});
  </code></pre>
  
  <p>What I would like to have in my test suite:</p>
  
  <pre><code>beforeEach(() =&gt; {
    jest.spyOn(selectors1, 'baseSelector').mockReturnValue('some value');
  });
  
  test('My test', () =&gt; {
    expect(selectors2.targetSelector()).toEqual('some value');
  });
  </code></pre>
  
  <p>But, this approach won't work as <code>targetSelector</code> is getting reference to <code>selectors1.baseSelector</code> during initialization of <code>selectors2.js</code> and mock is assigned to <code>selectors1.baseSelector</code> after it.</p>
  
  <p>There are 2 working solutions I see now:</p>
  
  <ol>
  <li>Mock entire <code>selectors1.js</code> module with <code>jest.mock</code>, however, it won't work if I'll need to change <code>selectors1.baseSelector</code> output for some specific cases</li>
  <li>Wrap every dependency selectors like this:</li>
  </ol>
  
  <hr>
  
  <pre><code>export const targetSelector = createSelector([(state) =&gt; selectors1.baseSelector(state)], () =&gt; {...});
  </code></pre>
  
  <p>But I don't like this approach a lot for obvious reasons.</p>
  
  <p>So, the question is next: is there any chance to mock Reselect selectors properly for unit testing?</p>