title: What is the difference between jest.fn() and jest.spyOn() methods in jest?
body: <p>I am writing the Unit test cases for my react project and using jest and enzyme for writing test cases. I have read the jest documentation </p>
  
  <p><a href="https://jestjs.io/docs/en/jest-object.html#jestspyonobject-methodname" rel="noreferrer">https://jestjs.io/docs/en/jest-object.html#jestspyonobject-methodname</a> </p>
  
  <p>which explains about <code>jest.spyOn()</code> method but I didn't understand completely. </p>
  
  <p>So I want to know more details about the specific places where we should use <code>jest.fn()</code> and Where we should/must use <code>jest.spyOn()</code>. It would be a great help if can be explained with an example for both methods.</p>
  
  <p>Thanks</p>