Hello,
I am creating unit tests for my Quasar app via the Jest app extension, and I managed to mock global objects with the exception of $q. Here is my code:
const wrapper = mount(NewPassword, {
localVue,
mocks: {
$router: {
push: jest.fn()
},
$q: {
notify: jest.fn()
},
$root: {}
}
});
When I run the tests I get the following error:
● NewPassword.vue › encountered a declaration exception
TypeError: Cannot read property 'isActive' of undefined
22 | localVue.use(Quasar, { components }); // , lang: langEn
23 |
> 24 | const wrapper = mount(NewPassword, {
| ^
25 | localVue,
26 | propsData: {
27 | showButton: false
The error output is long, but I figured this is probably the most important part. If I comment out the $q part all my tests pass, so the problem is with the $q mock. I even tried the empty $q: {} mock statement, same error.
Please help me she light on this problem.
Thank you,
Alex Z.