title: mock a function which is used in another function
body: <p>I am writing test for my async action in react redux, for sake of addressing just the issue I simplified the code here. Here is my action function:</p>
  
  <pre><code>export function updateUserAuthenticationStatus(){
  return function(dispatch){
     return axios.get(getLoginStatusUrl())
          .then(response =&gt; {
                 const middlewares = [thunk];
                 const mockStore = configureMockStore(middlewares);
                 const store = mockStore();
      return store.dispatch(updateUserAuthenticationStatus()).then(()=&gt;{
         //expect(store.getActions()[0]).to.eql(expectedActions);
      });
              });
          }).catch(function(response){
      });
    }
  }
  </code></pre>
  
  <p>So the problem is the function getLoginStatusUrl() which does couple of checks in the cookie and return the appropriate url based on some conditions. So what I want is to mock this function to return for example test.com then I can test my action as follows:</p>
  
  <pre><code>it("", () =&gt; {
          **here I want to mock getLoginStatusUrl() to return test.com**
      nock("test.com")
          .get("/")
          .reply(200,"test detail");
  
  })
  </code></pre>
  
  <p>How can I mock the getLoginStatusUrl() to return test.com in this scenario?</p>