I'm using redux-toolkit for my app, it allows write mutable reducers, but Jest doesn't collect coverage for mutable store changes:
export const slice = createSlice({
name: "auth",
initialState,
reducers: {
authorize:(draftState, action) => {
draftState.authorized = true;
}
}
});
if change it to immutable
export const slice = createSlice({
name: "auth",
initialState,
reducers: {
authorize:(state, action) => {
return {
...state,
authorized: true,
}
}
}
});
jest show that this reducer covered by tests
Do you know any ways how to make test coverage with Redux-toolkit (immer.js)
Aucun commentaire:
Enregistrer un commentaire