I'm working on a simple test scenario where I have the following code:
describe('App', () => {
let store;
beforeEach(() => {
store = new Vuex.Store({
modules: {
auth: {
namespaced: true,
getters: {
isLoggedIn: () => true,
}
}
}
});
});
test('App hides navbar when user is logged in', () => {
const wrapper = shallowMount(App, { store, localVue });
expect(wrapper.contains(Nav)).toBe(false);
// store.getters['auth/isLoggedIn'] = () => false; // Not possible
});
});
However, I am encountering an issue as I can't modify the getter value and receiving the following error in the console:
TypeError: Cannot set property auth/isLoggedIn of # which has only a getter
Can anyone suggest how should I go about setting the getter value in my test?