Vue.js - Testing asynchronously returned data
Since updating of vue component is done asynchronously you would need to use
// Inspect the generated HTML after a state update it('updates the rendered message when vm.message updates', done => { const vm = new Vue(MyComponent).$mount() vm.message = 'foo' // wait a "tick" after state change before asserting DOM updates Vue.nextTick(() => { expect(vm.$el.textContent).toBe('foo') done() }) })
Taken from official docs.