When using the provide mockStore, my feature/selector functions only see state as undefined.
Due to this, I am only able to mock the selectors and cannot therefore perform a more fully integrated test.
Are selectors not supposed to see state when it's provided by the mock store or should this work?
Creating the mock store
TestBed.configureTestingModule({
providers: [
AuthGuardGuard,
provideMockStore({
initialState: { ...initialState },
}),
],
});
Then logging the state that the selector should see, which is undefined.
export const currentUser = createSelector(
authRootFeature,
(state: fromAuthRoot.State) => {
console.log(state); // Undefined
return state.auth.currentUser;
}
);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…