title: How to unit test nested function in node js?
body: <p>I have a function for which I am writing unit test but that function is calling another function and there I am not able to mock/stub that function.</p>
  
  <p>for example :</p>
  
  <pre><code>function getValue( param1, param2, callback){
      getData(param1, param3).then( response) =&gt; {
           return callback();
      }, (err) =&gt; {
           return callback();
      });
  }
  </code></pre>
  
  <p>So I don't know how to mock <code>getData()</code> function.</p>