title: How to test SetTimeout function calld in VUE Created HOOK? using Vue utils - JEST
body: <p>I have an alert component which has a flag <code>isVisible</code>, this flag is becoming true when the component is created, and also in the created HOOK I have a <code>setTimeout</code> which starts if the component receives DESTROY boolean prop:</p>
  <pre><code>props: {
    destroy: {
      type: Boolean,
      default: false,
    },
  }
  </code></pre>
  <pre><code>data() {
    return {
      isVisible: false,
    }
  }
  </code></pre>
  <pre><code>created() {
    this.isVisible = true
    if (this.destroy) {
      setTimeout(() =&gt; {
        this.isVisible = false
      }, 2500)
    },
  }
  </code></pre>
  <p>I am using VUE UTILS / JEST to test if the component disappears after <code>setTimeout</code> is over, I've tried:</p>
  <pre><code>test('Component dissapears after 2.5 seconds when it receives DESTROY prop', async () =&gt; {
    const component = wrapper.get('[data-test-id=&quot;info-alert-wrapper&quot;]')
    await wrapper.setProps({
      destroy: true,
    })
  
    await wrapper.vm.$options.created.call()
  
    expect(component.isVisible()).toBeFalsy()
  })
  </code></pre>
  <p>But it responds: <code>TypeError: Cannot set property 'isVisible' of undefined</code></p>
  <p>Can somebody help me with this? thank u! :)</p>