Skip to content

Commit

Permalink
Revert "feat(router-store) Add base router selectors"
Browse files Browse the repository at this point in the history
This reverts commit 0f6a2fd.
  • Loading branch information
jasonhodges committed May 24, 2019
1 parent c0e82bf commit 0e1ef39
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1,303 deletions.
48 changes: 45 additions & 3 deletions modules/router-store/spec/router_selectors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,21 +118,21 @@ describe('Router State Selectors', () => {
it('should create a selector for selecting the query params', () => {
const result = selectors.selectQueryParams(state);

expect(result).toEqual(
expect(result.queryParams).toEqual(
state.router.state.root.firstChild.firstChild.queryParams
);
});
it('should create a selector for selecting the route params', () => {
const result = selectors.selectRouteParams(state);

expect(result).toEqual(
expect(result.params).toEqual(
state.router.state.root.firstChild.firstChild.params
);
});
it('should create a selector for selecting the route data', () => {
const result = selectors.selectRouteData(state);

expect(result).toEqual(
expect(result.data).toEqual(
state.router.state.root.firstChild.firstChild.data
);
});
Expand All @@ -142,4 +142,46 @@ describe('Router State Selectors', () => {
expect(url).toEqual(state.router.state.url);
});
});
// xdescribe('Uncomposed Selectors', () => {
// // interface State {
// // router: RouterReducerState<any>;
// // }
// type State = RouterReducerState<any>;
// let selectors: RouterStateSelectors<any, RouterReducerState<any>>;
// let state: State;
//
// beforeEach(() => {
// // state = {
// // router: mockData,
// // };
// state = mockData;
// selectors = getSelectors();
// });
// it('should create a selector for selecting the query params', () => {
// const result = selectors.selectQueryParams(state);
//
// expect(result.queryParams).toEqual(
// state.root.firstChild.firstChild.queryParams
// );
// });
// it('should create a selector for selecting the route params', () => {
// const result = selectors.selectRouteParams(state);
//
// expect(result.params).toEqual(
// state.router.state.root.firstChild.firstChild.params
// );
// });
// it('should create a selector for selecting the route data', () => {
// const result = selectors.selectRouteData(state);
//
// expect(result.data).toEqual(
// state.router.state.root.firstChild.firstChild.data
// );
// });
// it('should create a selector for selecting the url', () => {
// const url = selectors.selectUrl(state);
//
// expect(url).toEqual(state.router.state.url);
// });
// });
});
2 changes: 1 addition & 1 deletion modules/router-store/src/router_selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function getSelectors<V>(
selectState: (state: V) => RouterReducerState<any>
): RouterStateSelectors<any, V>;
export function getSelectors<T>(
selectState = (state: any) => state.state
selectState = (state: any) => state.state // is this what you are thinking for providing default selectState?
): RouterStateSelectors<T, any> {
const router = (state: any) => state;
const selectRouterState = createSelector(
Expand Down
Loading

0 comments on commit 0e1ef39

Please sign in to comment.