'route With Name 'something' Does Not Exist' Vue-router Console.warn When Using Vue-test-utils
I'm making test codes for vue.js component which uses vue-router using vue-test-utils. Here are codes related to this. const Routes = [{ ... }, ... { ..., path: '/transfers
Solution 1:
I did a lot of testing in the last project I was working on. I always mocked my $route and $router (see snippet). I've created a Codepen (includes the whole file) of a page I was testing. It shows my basic setup and some ways I was testing the routing object. ie
letmocks= {
$route: {
path:'/some-path',
query: {
amount:null,
loanType:null
}
},
$router: [],
$validator: {
validateAll:jest.fn()
},
$toast: {
show:jest.fn(),
error:jest.fn()
},
$withProcessing:jest.fn()
}
It's a little hard to exactly diagnose your prob without jumping into the code but I hope you get something out of the below that helps you out.
https://codepen.io/RuNpiXelruN/pen/XWRKmoE
Post a Comment for "'route With Name 'something' Does Not Exist' Vue-router Console.warn When Using Vue-test-utils"