Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(testscheduler): type arguments to Observable creation functions #3928

Merged
merged 1 commit into from
Jul 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spec/schedulers/TestScheduler-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ describe('TestScheduler', () => {
it('should create a cold observable', () => {
const expected = ['A', 'B'];
const scheduler = new TestScheduler(null);
const source = scheduler.createColdObservable<string>('--a---b--|', { a: 'A', b: 'B' });
const source = scheduler.createColdObservable('--a---b--|', { a: 'A', b: 'B' });
expect(source).to.be.an.instanceOf(Observable);
source.subscribe(x => {
expect(x).to.equal(expected.shift());
Expand All @@ -159,7 +159,7 @@ describe('TestScheduler', () => {
it('should create a cold observable', () => {
const expected = ['A', 'B'];
const scheduler = new TestScheduler(null);
const source = scheduler.createHotObservable<string>('--a---b--|', { a: 'A', b: 'B' });
const source = scheduler.createHotObservable('--a---b--|', { a: 'A', b: 'B' });
expect(source).to.be.an.instanceof(Subject);
source.subscribe(x => {
expect(x).to.equal(expected.shift());
Expand Down
14 changes: 12 additions & 2 deletions src/internal/testing/TestScheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ export class TestScheduler extends VirtualTimeScheduler {
return indexOf * TestScheduler.frameTimeFactor;
}

createColdObservable<T>(marbles: string, values?: any, error?: any): ColdObservable<T> {
/**
* @param marbles A diagram in the marble DSL. Letters map to keys in `values` if provided.
* @param values Values to use for the letters in `marbles`. If ommitted, the letters themselves are used.
* @param error The error to use for the `#` marble (if present).
*/
createColdObservable<T = string>(marbles: string, values?: { [marble: string]: T }, error?: any): ColdObservable<T> {
if (marbles.indexOf('^') !== -1) {
throw new Error('cold observable cannot have subscription offset "^"');
}
Expand All @@ -58,7 +63,12 @@ export class TestScheduler extends VirtualTimeScheduler {
return cold;
}

createHotObservable<T>(marbles: string, values?: any, error?: any): HotObservable<T> {
/**
* @param marbles A diagram in the marble DSL. Letters map to keys in `values` if provided.
* @param values Values to use for the letters in `marbles`. If ommitted, the letters themselves are used.
* @param error The error to use for the `#` marble (if present).
*/
createHotObservable<T = string>(marbles: string, values?: { [marble: string]: T }, error?: any): HotObservable<T> {
if (marbles.indexOf('!') !== -1) {
throw new Error('hot observable cannot have unsubscription marker "!"');
}
Expand Down