From b9816660bb03f7d32acff8f6797914b5e4d0fec4 Mon Sep 17 00:00:00 2001 From: Ben Lesh Date: Thu, 11 Jan 2018 21:41:41 -0800 Subject: [PATCH] feat(reorganize): hid testing implementation details BREAKING CHANGE: `HotObservable` and `ColdObservable`, and other testing support types are no longer exported directly. --- spec/helpers/marble-testing.ts | 8 ++++---- spec/observables/generate-spec.ts | 2 +- spec/subjects/ReplaySubject-spec.ts | 2 +- spec/testing/index-spec.ts | 8 ++++++++ src/Rx.ts | 2 +- src/{ => internal}/testing/ColdObservable.ts | 10 +++++----- src/{ => internal}/testing/HotObservable.ts | 10 +++++----- src/{ => internal}/testing/SubscriptionLog.ts | 0 src/{ => internal}/testing/SubscriptionLoggable.ts | 2 +- src/{ => internal}/testing/TestMessage.ts | 2 +- src/{ => internal}/testing/TestScheduler.ts | 8 ++++---- src/testing/index.ts | 1 + 12 files changed, 32 insertions(+), 23 deletions(-) create mode 100644 spec/testing/index-spec.ts rename src/{ => internal}/testing/ColdObservable.ts (84%) rename src/{ => internal}/testing/HotObservable.ts (84%) rename src/{ => internal}/testing/SubscriptionLog.ts (100%) rename src/{ => internal}/testing/SubscriptionLoggable.ts (92%) rename src/{ => internal}/testing/TestMessage.ts (60%) rename src/{ => internal}/testing/TestScheduler.ts (96%) create mode 100644 src/testing/index.ts diff --git a/spec/helpers/marble-testing.ts b/spec/helpers/marble-testing.ts index 56007993d6..15d7a71ee5 100644 --- a/spec/helpers/marble-testing.ts +++ b/spec/helpers/marble-testing.ts @@ -1,8 +1,8 @@ import { Observable } from '../../src/Observable'; -import { SubscriptionLog } from '../../src/testing/SubscriptionLog'; -import { ColdObservable } from '../../src/testing/ColdObservable'; -import { HotObservable } from '../../src/testing/HotObservable'; -import { TestScheduler, observableToBeFn, subscriptionLogsToBeFn } from '../../src/testing/TestScheduler'; +import { SubscriptionLog } from '../../src/internal/testing/SubscriptionLog'; +import { ColdObservable } from '../../src/internal/testing/ColdObservable'; +import { HotObservable } from '../../src/internal/testing/HotObservable'; +import { TestScheduler, observableToBeFn, subscriptionLogsToBeFn } from '../../src/internal/testing/TestScheduler'; declare const global: any; diff --git a/spec/observables/generate-spec.ts b/spec/observables/generate-spec.ts index f7c6fa1a0c..30b1f88c94 100644 --- a/spec/observables/generate-spec.ts +++ b/spec/observables/generate-spec.ts @@ -1,6 +1,6 @@ import * as Rx from '../../src/Rx'; import '../../src/add/observable/generate'; -import { TestScheduler } from '../../src/testing/TestScheduler'; +import { TestScheduler } from '../../src/internal/testing/TestScheduler'; import { expect } from 'chai'; declare const {asDiagram, expectObservable}; declare const rxTestScheduler: TestScheduler; diff --git a/spec/subjects/ReplaySubject-spec.ts b/spec/subjects/ReplaySubject-spec.ts index 9e774800e0..c86f4ae70f 100644 --- a/spec/subjects/ReplaySubject-spec.ts +++ b/spec/subjects/ReplaySubject-spec.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; import * as Rx from '../../src/Rx'; -import { TestScheduler } from '../../src/testing/TestScheduler'; +import { TestScheduler } from '../../src/internal/testing/TestScheduler'; import marbleTestingSignature = require('../helpers/marble-testing'); // tslint:disable-line:no-require-imports declare const hot: typeof marbleTestingSignature.hot; diff --git a/spec/testing/index-spec.ts b/spec/testing/index-spec.ts new file mode 100644 index 0000000000..60d2f1643a --- /dev/null +++ b/spec/testing/index-spec.ts @@ -0,0 +1,8 @@ +import * as index from '../../src/testing/index'; +import { expect } from 'chai'; + +describe('index', () => { + it('should export TestScheduler', () => { + expect(index.TestScheduler).to.exist; + }); +}); diff --git a/src/Rx.ts b/src/Rx.ts index ef1b85d8c2..bd551e502f 100644 --- a/src/Rx.ts +++ b/src/Rx.ts @@ -159,7 +159,7 @@ export {TimeoutError} from './util/TimeoutError'; export {UnsubscriptionError} from './util/UnsubscriptionError'; export {TimeInterval} from './internal/patching/operator/timeInterval'; export {Timestamp} from './internal/operators/timestamp'; -export {TestScheduler} from './testing/TestScheduler'; +export {TestScheduler} from './internal/testing/TestScheduler'; export {VirtualTimeScheduler} from './internal/scheduler/VirtualTimeScheduler'; export {AjaxRequest, AjaxResponse, AjaxError, AjaxTimeoutError} from './internal/observable/dom/AjaxObservable'; export { pipe } from './util/pipe'; diff --git a/src/testing/ColdObservable.ts b/src/internal/testing/ColdObservable.ts similarity index 84% rename from src/testing/ColdObservable.ts rename to src/internal/testing/ColdObservable.ts index 3ccfd46b71..9a0eae52fe 100644 --- a/src/testing/ColdObservable.ts +++ b/src/internal/testing/ColdObservable.ts @@ -1,11 +1,11 @@ -import { Observable } from '../internal/Observable'; -import { Subscription } from '../internal/Subscription'; -import { Scheduler } from '../internal/Scheduler'; +import { Observable } from '../Observable'; +import { Subscription } from '../Subscription'; +import { Scheduler } from '../Scheduler'; import { TestMessage } from './TestMessage'; import { SubscriptionLog } from './SubscriptionLog'; import { SubscriptionLoggable } from './SubscriptionLoggable'; -import { applyMixins } from '../util/applyMixins'; -import { Subscriber } from '../internal/Subscriber'; +import { applyMixins } from '../../util/applyMixins'; +import { Subscriber } from '../Subscriber'; /** * We need this JSDoc comment for affecting ESDoc. diff --git a/src/testing/HotObservable.ts b/src/internal/testing/HotObservable.ts similarity index 84% rename from src/testing/HotObservable.ts rename to src/internal/testing/HotObservable.ts index ff7ea287d0..f83c6515f9 100644 --- a/src/testing/HotObservable.ts +++ b/src/internal/testing/HotObservable.ts @@ -1,11 +1,11 @@ -import { Subject } from '../internal/Subject'; -import { Subscriber } from '../internal/Subscriber'; -import { Subscription } from '../internal/Subscription'; -import { Scheduler } from '../internal/Scheduler'; +import { Subject } from '../Subject'; +import { Subscriber } from '../Subscriber'; +import { Subscription } from '../Subscription'; +import { Scheduler } from '../Scheduler'; import { TestMessage } from './TestMessage'; import { SubscriptionLog } from './SubscriptionLog'; import { SubscriptionLoggable } from './SubscriptionLoggable'; -import { applyMixins } from '../util/applyMixins'; +import { applyMixins } from '../../util/applyMixins'; /** * We need this JSDoc comment for affecting ESDoc. diff --git a/src/testing/SubscriptionLog.ts b/src/internal/testing/SubscriptionLog.ts similarity index 100% rename from src/testing/SubscriptionLog.ts rename to src/internal/testing/SubscriptionLog.ts diff --git a/src/testing/SubscriptionLoggable.ts b/src/internal/testing/SubscriptionLoggable.ts similarity index 92% rename from src/testing/SubscriptionLoggable.ts rename to src/internal/testing/SubscriptionLoggable.ts index 7e5218e78b..1724137334 100644 --- a/src/testing/SubscriptionLoggable.ts +++ b/src/internal/testing/SubscriptionLoggable.ts @@ -1,4 +1,4 @@ -import { Scheduler } from '../internal/Scheduler'; +import { Scheduler } from '../Scheduler'; import { SubscriptionLog } from './SubscriptionLog'; export class SubscriptionLoggable { diff --git a/src/testing/TestMessage.ts b/src/internal/testing/TestMessage.ts similarity index 60% rename from src/testing/TestMessage.ts rename to src/internal/testing/TestMessage.ts index 4c776bc97b..a5a60ca1ca 100644 --- a/src/testing/TestMessage.ts +++ b/src/internal/testing/TestMessage.ts @@ -1,4 +1,4 @@ -import { Notification } from '../internal/Notification'; +import { Notification } from '../Notification'; export interface TestMessage { frame: number; diff --git a/src/testing/TestScheduler.ts b/src/internal/testing/TestScheduler.ts similarity index 96% rename from src/testing/TestScheduler.ts rename to src/internal/testing/TestScheduler.ts index 6a1d7d780f..8c7985529d 100644 --- a/src/testing/TestScheduler.ts +++ b/src/internal/testing/TestScheduler.ts @@ -1,11 +1,11 @@ -import { Observable } from '../internal/Observable'; -import { Notification } from '../internal/Notification'; +import { Observable } from '../Observable'; +import { Notification } from '../Notification'; import { ColdObservable } from './ColdObservable'; import { HotObservable } from './HotObservable'; import { TestMessage } from './TestMessage'; import { SubscriptionLog } from './SubscriptionLog'; -import { Subscription } from '../internal/Subscription'; -import { VirtualTimeScheduler, VirtualAction } from '../internal/scheduler/VirtualTimeScheduler'; +import { Subscription } from '../Subscription'; +import { VirtualTimeScheduler, VirtualAction } from '../scheduler/VirtualTimeScheduler'; const defaultMaxFrame: number = 750; diff --git a/src/testing/index.ts b/src/testing/index.ts new file mode 100644 index 0000000000..4c23a723bb --- /dev/null +++ b/src/testing/index.ts @@ -0,0 +1 @@ +export { TestScheduler } from '../internal/testing/TestScheduler';