title: How to test class instance inside a function with Jest
body: <p>I have the following hypothetical scenario:</p>
  
  <pre><code>// file MyClass.js in an external package
  class MyClass {
      myfunc = () =&gt; {
          // do something
      }
  }
  
  // file in my project
  function myFunctionToBeTested() {
      const instance = new MyClass()
      instance.myFunc()
  }
  </code></pre>
  
  <p>I need to create a test with Jest that makes sure <code>instance.myFunc</code> was called</p>