I'm having trouble testing my vue component using the vuex inside it.
This is one of my mapGetters
methods
listaSatelite() {
if (this.getCropsSelected._id!=undefined) {
}}
And this is the error i'm getting:
Cannot read property '_modulesNamespaceMap' of undefined
computed
...mapGetters("property",["getCropsSelected"]),
my spec fyle
import {shallowMount,createLocalVue} from '@vue/test-utils'
import Vuex from 'vuex'
import sateliteComponent from '@/components/satelite/listaSatelite.vue'
import sateliteStore from '@/core/modules/satelite/index.js'
var vueWithVuex = createLocalVue()
vueWithVuex.use(Vuex)
const store = new Vuex.Store({
sateliteStore
})
describe('testes componente satelite', () => {
test('instanciado', () => {
const wrapper = shallowMount(sateliteComponent)
console.log(wrapper)
});
});
erro log
TypeError: Cannot read property '_modulesNamespaceMap' of undefined
119 | },
120 | listaSatelite() {
> 121 | if (this.getCropsSelected._id!=undefined) {
| ^
122 | this.listSatelite({
123 | startDate: this.getCropsSelected.startDate,
124 | endDate: this.getCropsSelected.endDate
In my console it is pointing and showing that the error is in the method, as if he had not been able to import or find this getter
I'm not sure what I'm doing wrong, any help would be most welcome! If someone has a tutorial on how to test the vue with the vuex inside, but test the component, the ones I found on the internet are tests of the vuex itself