Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should clear next state', () => {
const { initialState } = fromReducer;
const beforeState = { ...initialState, nextState: initialState.state };
const action = {
...templateAction,
type: fromNgrxRouter.ROUTER_ERROR,
};
const state = fromReducer.reducer(beforeState, action);
expect(state.nextState).toBe(undefined);
});
});
export function reducer(
state: RouterState = initialState,
action: any
): RouterState {
switch (action.type) {
case fromNgrxRouter.ROUTER_NAVIGATION: {
return {
...state,
nextState: action.payload.routerState,
navigationId: action.payload.event.id,
};
}
case fromNgrxRouter.ROUTER_ERROR:
case fromNgrxRouter.ROUTER_CANCEL: {
return {
...state,
nextState: undefined,
};
}
case fromNgrxRouter.ROUTER_NAVIGATED: {
return {
state: action.payload.routerState,
navigationId: action.payload.event.id,
nextState: undefined,
};
}
default: {