TestScheduler

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

parseMarblesAsSubscriptions()

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

Parameters

marbles

Type: string.

runMode

Optional. Default is false.

Type: false.

Returns

SubscriptionLog

parseMarbles()

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

PropertyTypeDescription
hotObservables Read-only.
coldObservables Read-only.
assertDeepEqual Declared in constructor.

Methods

createTime()

createTime(marbles: string): number

Parameters

marbles

Type: string.

Returns

number

createColdObservable()

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()

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()

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

Parameters

observable

Type: Observable.

subscriptionMarbles

Optional. Default is null.

Type: string.

Returns

({ toBe: observableToBeFn; })

expectSubscriptions()

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

Parameters

actualSubscriptionLogs

Type: SubscriptionLog[].

Returns

({ toBe: subscriptionLogsToBeFn; })

flush()

flush()

Parameters

There are no parameters.

run()

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

Parameters

callback

Type: (helpers: RunHelpers) => T.

Returns

T