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 should populate the state and the navigationId', () => {
const { initialState } = fromReducer;
const action = {
...templateAction,
type: fromNgrxRouter.ROUTER_NAVIGATED,
};
const state = fromReducer.reducer(initialState, action);
expect(state.state).toBe(action.payload.routerState);
});
it('should clear nextState', () => {
it('should clear nextState', () => {
const initialState: RouterState = {
...fromReducer.initialState,
nextState: {
url: '',
queryParams: {},
params: {},
context: {
id: '',
},
cmsRequired: false,
},
};
const action = {
...templateAction,
type: fromNgrxRouter.ROUTER_NAVIGATED,
};
const state = fromReducer.reducer(initialState, action);
expect(state.nextState).toBe(undefined);
});
});
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: {
return state;
}
}
}