You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{mount,flushPromises}from'@vue/test-utils'import{createRouter,createWebHistory}from'vue-router'import{routes}from"@/router"letrouter;beforeEach(async()=>{router=createRouter({history: createWebHistory(),routes: routes,})router.push('/')awaitrouter.isReady()});test('allows authenticated user to edit a post',async()=>{constwrapper=mount(Component,{props: {isAuthenticated: true},global: {plugins: [router],}})constpush=jest.spyOn(router,'push')awaitwrapper.find('button').trigger('click')expect(push).toHaveBeenCalledTimes(1)expect(push).toHaveBeenCalledWith('/posts/1/edit')})
flushPromises is imported but is not used anywhere.
How should that be handled? Should the flushPromises be called after the button trigger event? I'd be happy to put up a PR for it!
The text was updated successfully, but these errors were encountered:
Describe the bug
In the docs there is a code example for Using a real router with Composition API. Here is the code example in it's current state:
flushPromises
is imported but is not used anywhere.How should that be handled? Should the
flushPromises
be called after the button trigger event? I'd be happy to put up a PR for it!The text was updated successfully, but these errors were encountered: