license import { Observable } from "rxjs" ; import { argsSymbol } from "./args" ; import { assertArgs , assertSubscriptions } from "./assert" ; import { ExpectHelpers , TestObservableLike } from "./types" ; export class Expect < T > { constructor ( private actual , private helpers , private subscription ? ) { } toBeObservable ( expected ) ; toBeObservable ( expected , values ? , error ? ) ; toBeObservable ( expected , values ? , error ? ) { const { actual , helpers , subscription } = this ; if ( typeof expected === "string" ) { helpers . expectObservable ( actual , subscription ) . toBe ( expected , values , error ) ; } else { assertArgs ( expected ) ; const { error , marbles , values } = expected [ argsSymbol ] ; helpers . expectObservable ( actual , subscription ) . toBe ( marbles , values , error ) ; } } toHaveSubscriptions ( expected ) { const { actual , helpers } = this ; assertSubscriptions ( actual ) ; const { subscriptions } = actual as TestObservableLike < T > ; helpers . expectSubscriptions ( subscriptions ) . toBe ( expected ) ; } }