vuex-module-decorators
vuex-module-decorators copied to clipboard
How to mock a store module instance?
Hello everyone,
I have a fixed instance of my store module which I use in my Vue components and outside of Vue in some typescript files. Regarding unit tests I want to mock this instance in order to test my Vue component. I want to set its states and mock its getters. So far I was able to mock its states but I failed to somehow mock its getters
I have the following environment:
MyModule.ts:
@Module({ name: 'myModule ', namespaced: true, dynamic: true, store: globalStore})
export class MyModule extends VuexModule {
}
export const myModuleInstance = getModule(MyModule , globalStore);
My question is, if anyone already mocked such module instance like myModuleInstance
within a test?
If I take a look in that module instance, then I see that it become quite complex compared to my class-syntax. So I wonder if it is even possible to mock it?? Any help?