refactor(test-util): moved `marbles.spec-util` to common `util` folder
MODIFY
packages/core/src/effects/effects.combiner.spec.ts
packages/core/src/effects/effects.combiner.spec.ts
import { mapTo, tap } from 'rxjs/operators';
+import { Marbles } from '../../../util/marbles.spec-util';
import { HttpRequest, HttpResponse } from '../http.interface';
-import { Marbles } from '../util/marbles.spec-util';
import { combineEffects, combineMiddlewareEffects, combineRoutes } from './effects.combiner';
import { Effect, GroupedEffects } from './effects.interface';

MODIFY
packages/core/src/middlewares/error.middleware.spec.ts
packages/core/src/middlewares/error.middleware.spec.ts
import { mapTo } from 'rxjs/operators';
+import { Marbles } from '../../../util/marbles.spec-util';
import { HttpRequest, HttpResponse } from '../http.interface';
import { HttpError } from '../util/error.util';
-import { Marbles } from '../util/marbles.spec-util';
import { error$, getErrorMiddleware } from './error.middleware';
const createMockRes = () => ({} as HttpResponse);

MODIFY
packages/core/src/operators/matchPath/matchPath.operator.spec.ts
packages/core/src/operators/matchPath/matchPath.operator.spec.ts
+import { Marbles } from '../../../../util/marbles.spec-util';
import { HttpRequest, QueryParameters, RouteParameters } from '../../http.interface';
-import { Marbles } from '../../util/marbles.spec-util';
import { matchPath } from './matchPath.operator';
const req = (url: string) => ({ url } as HttpRequest);

MODIFY
packages/core/src/operators/matchType/matchType.operator.spec.ts
packages/core/src/operators/matchType/matchType.operator.spec.ts
+import { Marbles } from '../../../../util/marbles.spec-util';
import { HttpRequest } from '../../http.interface';
-import { Marbles } from '../../util/marbles.spec-util';
import { matchType } from './matchType.operator';
const createMockReq = (method: string) => ({ method } as HttpRequest);

MODIFY
packages/core/src/operators/use/use.operator.spec.ts
packages/core/src/operators/use/use.operator.spec.ts
import { tap } from 'rxjs/operators';
+import { Marbles } from '../../../../util/marbles.spec-util';
import { Effect } from '../../effects/effects.interface';
import { HttpRequest } from '../../http.interface';
-import { Marbles } from '../../util/marbles.spec-util';
import { use } from './use.operator';
const createMockReq = (test = 0) => ({ test } as any as HttpRequest);

MODIFY
packages/middleware-body/src/indes.spec.ts
packages/middleware-body/src/indes.spec.ts
import { HttpRequest, HttpResponse } from '@marblejs/core';
import { of } from 'rxjs';
-import { Marbles } from '../../core/src/util/marbles.spec-util';
+import { Marbles } from '../../util/marbles.spec-util';
import { bodyParser$ } from './index';
const MockReq = require('mock-req');

MODIFY
packages/middleware-logger/src/index.spec.ts
packages/middleware-logger/src/index.spec.ts
import { HttpRequest, HttpResponse } from '@marblejs/core';
import { EventEmitter } from 'events';
-import { Marbles } from '../../core/src/util/marbles.spec-util';
+import { Marbles } from '../../util/marbles.spec-util';
import { logger$ } from './index';
const createMockReq = (url: string, method: string) => ({ url, method } as HttpRequest);

RENAME
packages/core/src/util/marbles.spec-util.ts
packages/util/marbles.spec-util.ts
import { Observable, OperatorFunction, from } from 'rxjs';
import { TestScheduler } from 'rxjs/testing';
-import { Effect } from '../effects/effects.interface';
-import { HttpRequest, HttpResponse } from '../http.interface';
+import { Effect } from '../core/src/effects/effects.interface';
+import { HttpRequest, HttpResponse } from '../core/src/http.interface';
type MarbleFlow = [string, object];
-type MarbleDependencies = { response: HttpResponse, error?: Error };
+type MarbleDependencies = { response: HttpResponse; error?: Error };
export namespace Marbles {
+ const deepEquals = (actual, expected) => expect(actual).toEqual(expected);
- const deepEquals = (actual, expected) =>
- expect(actual).toEqual(expected);
-
- const createTestScheduler = () =>
- new TestScheduler(deepEquals);
+ const createTestScheduler = () => new TestScheduler(deepEquals);
export const assert = <T>(
operators: OperatorFunction<T, any>[],
- marbleflow: [MarbleFlow, MarbleFlow]
+ marbleflow: [MarbleFlow, MarbleFlow],
) => {
const [initStream, initValues] = marbleflow[0];
const [expectedStream, expectedValues] = marbleflow[1];
@@ -59,11 +56,8 @@ export namespace Marbles {
const [expectedStream, expectedValues] = marbleflow;
const scheduler = createTestScheduler();
- scheduler
- .expectObservable(effects$)
- .toBe(expectedStream, expectedValues);
+ scheduler.expectObservable(effects$).toBe(expectedStream, expectedValues);
scheduler.flush();
};
-
}

refactor(test-util): moved `marbles.spec-util` to common `util` folder