I have a meta reducer that should clear the state when logging out.
export function clearState(reducer: ActionReducer<any>): ActionReducer<any> {
return (state, action) => {
if (action.type === AuthActionTypes.UNAUTHENTICATED) {
state = undefined;
}
return reducer(state, action);
};
}
export const metaReducers: MetaReducer<any>[] = [clearState];
I want to unit test this piece of code. I have tested normal reducers before but for me it is hard to apply the same technique when writing a test for the meta reducer. And there are no examples in the docs.