title: How to spy on individual functions that are default exports
body: <p>I am trying to spy on a function that is used by the function I am actually testing, so the structure is a bit like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>const trueOrFalse = (args) =&gt; {
    return true // or false;
  }
  
  export default TrueOrFalse;
  </code></pre>
  
  <p>and the function I want to import it into does</p>
  
  <pre class="lang-js prettyprint-override"><code>import trueOrFalse from './trueOrFalse';
  
  const myFunc = () =&gt; {
    const successful = trueOrFalse();
    if (!successful) return;
    // Otherwise do something else
  }
  </code></pre>
  
  <p>For my test now I need my <code>trueOrFalse()</code> to always return <code>false</code> for example. If this was exported differently I'd be able to use <code>jest.spyOn</code> like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>  jest.spyOn(utils, 'trueOrFalse').mockImplementation(() =&gt; false);
  </code></pre>
  
  <p>But with this being a default export I can't do this, can I?</p>
  
  <pre class="lang-js prettyprint-override"><code>  jest.spyOn(???, 'trueOrFalse').mockImplementation(() =&gt; false);
  </code></pre>
  
  <p>How can I spy on or mock this dependent function?</p>