Skip to content

Commit

Permalink
refactor: Rename unsubscription parameter.
Browse files Browse the repository at this point in the history
Subscriptions can be included in the diagram, too. See
ReactiveX/rxjs#3997
  • Loading branch information
cartant committed Apr 20, 2019
1 parent 75a8705 commit ac61708
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ interface Context {
configure(options: Configuration): void;
equal<T = any>(actual: Observable<T>, expected: Observable<T>): void;
equal<T = any>(actual: Observable<T>, expected: string, values?: { [key: string]: T }, error?: any): void;
equal<T = any>(actual: Observable<T>, unsubscription: string, expected: Observable<T>): void;
equal<T = any>(actual: Observable<T>, unsubscription: string, expected: string, values?: { [key: string]: T }, error?: any): void;
expect<T = any>(actual: Observable<T>, unsubscription?: string): Expect<T>;
equal<T = any>(actual: Observable<T>, subscription: string, expected: Observable<T>): void;
equal<T = any>(actual: Observable<T>, subscription: string, expected: string, values?: { [key: string]: T }, error?: any): void;
expect<T = any>(actual: Observable<T>, subscription?: string): Expect<T>;
flush(): void;
has<T = any>(actual: Observable<T>, expected: string | string[]): void;
hot<T = any>(marbles: string, values?: any, error?: any): HotObservable<T>;
Expand Down
8 changes: 4 additions & 4 deletions source/context-deprecated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ export class DeprecatedContext implements Context {
): void;
equal<T = any>(
actual: Observable<T>,
unsubscription: string,
subscription: string,
expected: TestObservableLike<T>
): void;
equal<T = any>(
actual: Observable<T>,
unsubscription: string,
subscription: string,
expected: string,
values?: { [key: string]: T },
error?: any
Expand All @@ -141,9 +141,9 @@ export class DeprecatedContext implements Context {
}
}

expect<T = any>(actual: Observable<T>, unsubscription?: string): Expect<T> {
expect<T = any>(actual: Observable<T>, subscription?: string): Expect<T> {
const { scheduler } = this;
return new Expect(actual as any, scheduler, unsubscription);
return new Expect(actual as any, scheduler, subscription);
}

flush(): void {
Expand Down
8 changes: 4 additions & 4 deletions source/context-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ export class RunContext implements Context {
): void;
equal<T = any>(
actual: Observable<T>,
unsubscription: string,
subscription: string,
expected: TestObservableLike<T>
): void;
equal<T = any>(
actual: Observable<T>,
unsubscription: string,
subscription: string,
expected: string,
values?: { [key: string]: T },
error?: any
Expand All @@ -85,9 +85,9 @@ export class RunContext implements Context {
}
}

expect<T = any>(actual: Observable<T>, unsubscription?: string): Expect<T> {
expect<T = any>(actual: Observable<T>, subscription?: string): Expect<T> {
const { helpers_ } = this;
return new Expect(actual as any, helpers_, unsubscription);
return new Expect(actual as any, helpers_, subscription);
}

flush(): void {
Expand Down
6 changes: 3 additions & 3 deletions source/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ export interface Context {
): void;
equal<T = any>(
actual: Observable<T>,
unsubscription: string,
subscription: string,
expected: TestObservableLike<T>
): void;
equal<T = any>(
actual: Observable<T>,
unsubscription: string,
subscription: string,
expected: string,
values?: { [key: string]: T },
error?: any
): void;
expect<T = any>(actual: Observable<T>, unsubscription?: string): Expect<T>;
expect<T = any>(actual: Observable<T>, subscription?: string): Expect<T>;
flush(): void;
has<T = any>(actual: Observable<T>, expected: string | string[]): void;
hot<T = any>(
Expand Down
8 changes: 4 additions & 4 deletions source/expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class Expect<T> {
constructor(
private actual: Observable<T>,
private helpers: ExpectHelpers,
private unsubscription?: string
private subscription?: string
) {}

toBeObservable(expected: TestObservableLike<T>): void;
Expand All @@ -26,17 +26,17 @@ export class Expect<T> {
values?: { [key: string]: T },
error?: any
): void {
const { actual, helpers, unsubscription } = this;
const { actual, helpers, subscription } = this;

if (typeof expected === "string") {
helpers
.expectObservable(actual, unsubscription)
.expectObservable(actual, subscription)
.toBe(expected, values, error);
} else {
assertArgs(expected);
const { error, marbles, values } = expected[argsSymbol];
helpers
.expectObservable(actual, unsubscription)
.expectObservable(actual, subscription)
.toBe(marbles, values, error);
}
}
Expand Down

0 comments on commit ac61708

Please sign in to comment.