dimanche 18 août 2019

Testing a method in vue-js with jest? Handling promises with flushPromises. Any example?

I need to write a few test cases for my vue js project. But stuck with api-calls testing using axios. The method isn't calling anyway. I did try all the way i have. Does anyone do the same? I need an example. Thanks.

 test('search working properly', async () => {
    const wrapper = factory()
    wrapper.vm.search()
    await flushPromises()
    expect(wrapper.vm.items).toBe(true)
  })

I need an example that actually works.

Aucun commentaire:

Enregistrer un commentaire