我在nuxt上使用vue test utils,我有标准突变
this.$store.commit(
'users/UPDATE_NAME',
this.username
)
在我的.spec中,我正在尝试访问此突变,但出现错误
TypeError:无法读取未定义的属性“ commit”
我也尝试过嘲笑它
it("It should commit the change name mutation", () => {
const wrapper = shallowMount(ChangeName, {
mocks: {
$store: {
// what goes here
}
但是不知道如何设置包装器,因此它可以访问模块“用户”中的突变
this.$store.commit('users/UPDATE_NAME',this.username)
如何设置.spec以访问此突变?