title: Stub function calls inside a function
body: <p>I'm writing a web app using <code>nodejs</code>. I have some utils functions which I export and test separately. There is another function though, that calls some of those utils functions that I would like to stub (using <code>sinon</code>).<br>
  From what I've seen so far, I can only stub methods on objects, so how should I design my utilities functions so I can test all of them?</p>
  
  <pre><code>function util1() {
      ...
  }
  
  function util2() {
      ...
  }
  
  function util3() {
      ...
      util1();
      ...
      util2();
  }
  
  export {
      util1,
      util2,
      util3
  }
  </code></pre>
  
  <p>Inside <code>util3</code> I want to mock (or stub) the calls for <code>util1</code> and <code>util2</code>.</p>