imp: fixed failing tests for matchPath and reorganized file structure
MODIFY
packages/core/src/effects/effects.combiner.ts
packages/core/src/effects/effects.combiner.ts
import { merge, of } from 'rxjs';
import { mergeMap, switchMap } from 'rxjs/operators';
import { HttpRequest } from '../http.interface';
-import { matchPath } from '../operators/matchPath.operator';
+import { matchPath } from '../operators';
import { isGroup } from './effects.helpers';
import { EffectCombiner, MiddlewareCombiner, RouteCombiner } from './effects.interface';

MODIFY
packages/core/src/http.listener.spec.ts
packages/core/src/http.listener.spec.ts
@@ -4,8 +4,7 @@ import { combineRoutes } from './effects/effects.combiner';
import { Effect } from './effects/effects.interface';
import { HttpRequest } from './http.interface';
import { httpListener } from './http.listener';
-import { matchPath } from './operators/matchPath.operator';
-import { use } from './operators/use.operator';
+import { matchPath, use } from './operators';
describe('Http listener', () => {
@@ -56,19 +55,19 @@ describe('Http listener', () => {
it('integrates with "matchPath" operator', async () => {
const effect$1: Effect = req$ => req$.pipe(
matchPath('/test/:id/foo'),
- map(req => req.route.params.id),
+ map(req => req.params.id),
map(id => ({ status: 200, body: { id } })),
);
const effect$2: Effect = req$ => req$.pipe(
matchPath('/test/:id/foo/:id/test'),
- map(req => req.route.params),
+ map(req => req.params),
map(params => ({ status: 200, body: { id: params.id } })),
);
const effect$3: Effect = req$ => req$.pipe(
matchPath('/test/:id/bar/:type/test'),
- map(req => req.route.params),
+ map(req => req.params),
map(params => ({ status: 200, body: { id: params.id, type: params.type } })),
);
@@ -92,7 +91,7 @@ describe('Http listener', () => {
it('integrates with "combineRoutes"', async () => {
const effect$: Effect = req$ => req$.pipe(
matchPath('/user/:id'),
- map(req => req.route.params),
+ map(req => req.params),
map(params => ({ status: 200, body: { id: params.id, version: params.version } })),
);

MODIFY
packages/core/src/index.ts
packages/core/src/index.ts
@@ -3,9 +3,7 @@ export { combineRoutes } from './effects/effects.combiner';
export * from './middlewares/bodyParser.middleware';
export * from './middlewares/error.middleware';
export * from './middlewares/logger.middleware';
-export * from './operators/matchType.operator';
-export * from './operators/matchPath.operator';
-export * from './operators/use.operator';
+export * from './operators';
export * from './http.interface';
export * from './http.listener';
export { HttpError } from './util/error.util';

MODIFY
packages/core/src/operators/index.ts
packages/core/src/operators/index.ts
export { matchPath } from './matchPath/matchPath.operator';
+export { matchType } from './matchType/matchType.operator';
export { use } from './use/use.operator';

MODIFY
packages/core/src/operators/matchPath/matchPath.operator.spec.ts
packages/core/src/operators/matchPath/matchPath.operator.spec.ts
@@ -3,11 +3,11 @@ import { Marbles } from '../../util/marbles.spec-util';
import { matchPath } from './matchPath.operator';
const req = (url: string) => ({ url } as HttpRequest);
-const reqMatched = (url: string, query = '', matchers: string[] = [], params?: RouteParameters) => ({
+const reqMatched = (url: string, query = '', matchers: string[] = [], params: RouteParameters = {}) => ({
url: !!query ? `${url}?${query}` : url,
matchers,
- params: params,
-} as HttpRequest);
+ params,
+} as any as HttpRequest);
describe('matchPath operator', () => {
let operators;

RENAME
packages/core/src/operators/matchPath/matchType.operator.spec.ts
packages/core/src/operators/matchType/matchType.operator.spec.ts
RENAME
packages/core/src/operators/matchPath/matchType.operator.ts
packages/core/src/operators/matchType/matchType.operator.ts
imp: fixed failing tests for matchPath and reorganized file structure