title: Sinon stub replacing function not working
body: <p>I am isolated the problem I am facing in my nodeJs here. Sinon stubbing on a dependent function is not working as expected. I didn't get what I am missing here. Appreciate help. Here is the sample code.</p>
  
  <p>sinonTest.js</p>
  
  <pre><code>"use strict";
  function getSecretNumber () {
    return 44;
  }
  function getTheSecret () {
    return `The secret was: ${getSecretNumber()}`;
  }
  
  module.exports = {
    getSecretNumber,
    getTheSecret,
  };
  </code></pre>
  
  <p>sinonTest_spec.ts</p>
  
  <pre><code>"use strict";
  const sinon = require("sinon");
  const sinonMediator = require("./sinonTest");
  const assert = require("assert");
  
  describe("moduleUnderTest", function () {
    describe("when the secret is 3", function () {
      beforeEach(function () {
        sinon.stub(sinonMediator, "getSecretNumber").returns(3);
      });
      afterEach(function (done) {
        sinon.restore();
        done();
      });
      it("should be returned with a string prefix", function () {
        const result = sinonMediator.getTheSecret();
        const stubValue = sinonMediator.getSecretNumber();    
        assert.equal(stubValue, 3);                         //this assertion passed
        assert.equal(result, "The secret was: 3");          //but this assertion failed.
      });
    });
  });
  </code></pre>
  
  <p>Here is the assertion error I am getting when I executed test case.</p>
  
  <pre><code>AssertionError [ERR_ASSERTION]: 'The secret was: 44' == 'The secret was: 3'
  </code></pre>
  
  <p>Thank you.</p>