W3cubDocs

/RxJS

TestScheduler

class stable

class TestScheduler extends VirtualTimeScheduler {
  static parseMarblesAsSubscriptions(marbles: string, runMode: false = false): SubscriptionLog
  static parseMarbles(marbles: string, values?: any, errorValue?: any, materializeInnerObservables: boolean = false, runMode: false = false): TestMessage[]
  constructor(assertDeepEqual: (actual: any, expected: any) => boolean | void)
  get hotObservables: HotObservable<any>[]
  get coldObservables: ColdObservable<any>[]
  assertDeepEqual: (actual: any, expected: any) => boolean | void
  createTime(marbles: string): number
  createColdObservable<T = string>(marbles: string, values?: {...}, error?: any): ColdObservable<T>
  createHotObservable<T = string>(marbles: string, values?: {...}, error?: any): HotObservable<T>
  expectObservable(observable: Observable<any>, subscriptionMarbles: string = null): ({...})
  expectSubscriptions(actualSubscriptionLogs: SubscriptionLog[]): ({...})
  flush()
  run<T>(callback: (helpers: RunHelpers) => T): T

  // inherited from index/VirtualTimeScheduler
  protected static frameTimeFactor: number
  constructor(SchedulerAction: typeof AsyncAction = VirtualAction as any, maxFrames: number = Number.POSITIVE_INFINITY)
  frame: number
  index: number
  maxFrames: number
  flush(): void
}

Static Methods

static parseMarblesAsSubscriptions(marbles: string, runMode: false = false): SubscriptionLog

Parameters

marbles

Type: string.

runMode

Optional. Default is false.

Type: false.

Returns

SubscriptionLog

static parseMarbles(marbles: string, values?: any, errorValue?: any, materializeInnerObservables: boolean = false, runMode: false = false): TestMessage[]

Parameters

marbles

Type: string.

values

Optional. Default is undefined.

Type: any.

errorValue

Optional. Default is undefined.

Type: any.

materializeInnerObservables

Optional. Default is false.

Type: boolean.

runMode

Optional. Default is false.

Type: false.

Returns

TestMessage[]

Constructor

constructor(assertDeepEqual: (actual: any, expected: any) => boolean | void)

Parameters

assertDeepEqual

Type: (actual: any, expected: any) => boolean | void.

Properties

Property Type Description
hotObservables HotObservable<any>[] Read-only.
coldObservables ColdObservable<any>[] Read-only.
assertDeepEqual (actual: any, expected: any) => boolean | void Declared in constructor.

Methods

createTime(marbles: string): number

Parameters

marbles

Type: string.

Returns

number

createColdObservable<T = string>(marbles: string, values?: { [marble: string]: T; }, error?: any): ColdObservable<T>

Parameters

marbles

A diagram in the marble DSL. Letters map to keys in values if provided.

values

Optional. Default is undefined.

Values to use for the letters in marbles. If ommitted, the letters themselves are used.

error

Optional. Default is undefined.

The error to use for the # marble (if present).

Returns

ColdObservable<T>

createHotObservable<T = string>(marbles: string, values?: { [marble: string]: T; }, error?: any): HotObservable<T>

Parameters

marbles

A diagram in the marble DSL. Letters map to keys in values if provided.

values

Optional. Default is undefined.

Values to use for the letters in marbles. If ommitted, the letters themselves are used.

error

Optional. Default is undefined.

The error to use for the # marble (if present).

Returns

HotObservable<T>

expectObservable(observable: Observable<any>, subscriptionMarbles: string = null): ({ toBe: observableToBeFn; })

Parameters

observable

Type: Observable.

subscriptionMarbles

Optional. Default is null.

Type: string.

Returns

({ toBe: observableToBeFn; })

expectSubscriptions(actualSubscriptionLogs: SubscriptionLog[]): ({ toBe: subscriptionLogsToBeFn; })

Parameters

actualSubscriptionLogs

Type: SubscriptionLog[].

Returns

({ toBe: subscriptionLogsToBeFn; })

flush()

Parameters

There are no parameters.

run<T>(callback: (helpers: RunHelpers) => T): T

Parameters

callback

Type: (helpers: RunHelpers) => T.

Returns

T

© 2015–2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors.
Code licensed under an Apache-2.0 License. Documentation licensed under CC BY 4.0.
https://rxjs.dev/api/testing/TestScheduler