title: Unit test for aws lambda using jest
body: <pre><code>const invokeApi = require("/opt/nodejs/kiwiCall");
  const decrypt = require("/opt/nodejs/encryption");
  const cors = require("/opt/nodejs/cors");
  </code></pre>
  
  <p>When I am testing my index.js file by manual mocking these dependencies in <strong>mocks</strong> directory as follows:</p>
  
  <pre><code>__mocks__ 
      |_invokeApi
      |_decrypt
      |_cors
  </code></pre>
  
  <p>it says</p>
  
  <pre><code>FAIL  ./index.test.js
    ● Test suite failed to run
  
      Cannot find module '/opt/nodejs/kiwiCall' from 'index.js'
  
      However, Jest was able to find:
          '../../../../lambdas/Flights/Locations/index.js'
  
      You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'jsx', 'ts', 'tsx', 'node'].
  
      See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string
  
        1 | "use strict";
        2 | 
      &gt; 3 | const invokeApi = require("/opt/nodejs/kiwiCall");
  </code></pre>
  
  <p>Wanted to know how can I mock the dependencies of AWS lambda in inedx.test.js file</p>