title: How to provide stub implementation of class in Vue Jest test
body: <p>I have the following question regarding testing in Vue 2 with Jest.</p>
  <p>Let's say I have a custom class</p>
  <pre><code>export class CustomDebouncer extends Debouncer{
  
   public triggerUpdate(): void {
  
   timeout(() =&gt; {
    }, timeOut)
   }
  
  }
  
  </code></pre>
  <pre><code>export class ClassA {
  
  private _debouncer: CustomDebouncer;
  
  }
  
  </code></pre>
  <p>How do I, in this case, replace the <code>debouncer</code> property in ClassA with a stub (and possibly als for all the rest of the classes that use the CustomDebouncer class in any way)?</p>
  <pre><code>export class CustomDebouncerStub {
  
   triggerUpdate(): void {
     console.log('stub update called')
   }
  }
  
  </code></pre>
  <p>I tried the explanation on <a href="https://jestjs.io/docs/es6-class-mocks" rel="nofollow noreferrer">https://jestjs.io/docs/es6-class-mocks</a> but I can't seem to figure out how to work this out. I tried to mock with <code>CustomDebouncer.prototype.triggerUpdate = jest.mock.fn()</code> but I don't have access to <code>this</code> then.</p>
  <p>Anybody got any pointers for me in this issue? Thanks!</p>