title: Correct way to import mocked functions from node modules using Jest
body: <p>I'm learning Jest and it seems like this should be so simple, but I'm missing the forest for the trees and would appreciate some guidance.</p>
  
  <p>I am using Jest to test Express routes.  The express routes are in the file <code>/routes/index.js</code> and they each call a corresponding logic function in a file <code>/logic/index.js</code>.  <code>routes</code> and <code>logic</code> directories are next to each other, at the same level.</p>
  
  <p>I then put a <code>__mocks__</code> directory inside of directory <code>logic</code> and create a <code>index.js</code> file inside <code>__mocks__</code></p>
  
  <pre><code>//  logic/__mocks__/index.js
  import clients from '../../../data/clients'
  
  export const getUserForUserName =  (name) =&gt; {
   return Promise.resolve(()=&gt; clients.filter(client =&gt; client.name === name) )
  }
  </code></pre>
  
  <p>I create a <code>__tests__</code> directory inside <code>routes</code> and put an <code>index.js</code> file inside it</p>
  
  <pre><code>// routes/__tests_/index.js
  jest.mock("../../logic");
  import {getUserForUserName} from "../../logic/__mocks__"
  
  
      it("gets correct data for user name", async () =&gt; {
    const data = await getUserForUserName("Ines");
    expect(data).toEqual([{"email": "inesblankenship@quotezart.com", "id": "4a0573eb-56d0-45d5-ab36-bebf33c5eb36", "name": "Ines", "role": "admin"}]);
  });
  </code></pre>
  
  <p>Is this the correct way to set this up?  The line</p>
  
  <pre><code>import {getUserForUserName} from "../../logic/__mocks__"
  </code></pre>
  
  <p>seems so 'hardwired' to me, but I suppose it has to be this way.  Any suggestions much appreciated.</p>