I have a simple store setup like this
src/store/index.js
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
strict: true,
state: {
search: ''
},
mutations: {
UPDATE_SEARCH(state, { query }) {
state.search = query
}
}
})
However in my Unit Test, I include the store, but when I console.log the mutations property it returns undefined
import store from '@/store'
console.log(store.mutations)
When I console.log the store object, I can see _mutations property set, logging store.state is also working fine. Any idea why the mutations object isn't being read?
TypeError: Cannot read property 'UPDATE_SEARCH' of undefined
Aucun commentaire:
Enregistrer un commentaire