title: stub method in jest
body: <p>I have a method loadDataFromLocalStorage() in one of my react component.</p>
  
  <p>loadDataFromLocalStorage() will get the item from localStorage and return it.</p>
  
  <p>So I am writing unit test cases for myFunc().</p>
  
  <pre><code>myFunc(){
      var data = loadDataFromLocalStorage()();
      if(data) {
        return true;
      }    
    }
  </code></pre>
  
  <p>When I tried to run my test I see that loadDataFromLocalStorage() is not retrieving the data from localStorage. So I guess tests wont be able to access localStorage and return the data.</p>
  
  <p>So as an alternative I need to stub the value for 
  loadDataFromLocalStorage() and return it so that myFunc can be unit tested.</p>
  
  <p>Please advise..</p>