【发布时间】:2021-10-04 20:24:08
【问题描述】:
知道是否可以仅模拟全局存储中的 getter 吗?
我试过这段代码,但它不起作用:
import store from '@/store';
import Vuex from "vuex";
const localVue = createLocalVue();
localVue.use(VueRouter);
localVue.use(Vuex);
const wrapper = mount(App, {
mocks: {
$store: {
getters: {
isLoggedIn: () => true // This is always returning false. I need this getter to return true value
},
}
},
store, // this is the global store for my application
localVue,
router,
});
【问题讨论】:
标签: vuejs2 vuex vue-test-utils