I am in the process of migrating to Vue3, so please excuse me for not just using Pinia. I have a reducer like this:
export const mutations: MutationTree<UiState> = {
SET_LOADING: (state, loading) => {
Object.assign(state, loading); // before Vue3 this was Vue.set(...) for reactivity
},
};
and a test like this
it('should set consultationLoading', () => {
const state = uiState();
const loading = true;
const { SET_LOADING } = mutations;
SET_LOADING(state, loading);
expect(state.loading).toBe(loading);
});
Since I cannot use Vue.set() (from import Vue from 'vue';) anymore, I just went with Object.assign as recommended in another post. But the state is not updating in the test.