[6a3a178] | 1 | import { Observable } from '../Observable';
|
---|
| 2 | import { ColdObservable } from './ColdObservable';
|
---|
| 3 | import { HotObservable } from './HotObservable';
|
---|
| 4 | import { TestMessage } from './TestMessage';
|
---|
| 5 | import { SubscriptionLog } from './SubscriptionLog';
|
---|
| 6 | import { VirtualTimeScheduler } from '../scheduler/VirtualTimeScheduler';
|
---|
| 7 | export interface RunHelpers {
|
---|
| 8 | cold: typeof TestScheduler.prototype.createColdObservable;
|
---|
| 9 | hot: typeof TestScheduler.prototype.createHotObservable;
|
---|
| 10 | flush: typeof TestScheduler.prototype.flush;
|
---|
| 11 | expectObservable: typeof TestScheduler.prototype.expectObservable;
|
---|
| 12 | expectSubscriptions: typeof TestScheduler.prototype.expectSubscriptions;
|
---|
| 13 | }
|
---|
| 14 | export declare type observableToBeFn = (marbles: string, values?: any, errorValue?: any) => void;
|
---|
| 15 | export declare type subscriptionLogsToBeFn = (marbles: string | string[]) => void;
|
---|
| 16 | export declare class TestScheduler extends VirtualTimeScheduler {
|
---|
| 17 | assertDeepEqual: (actual: any, expected: any) => boolean | void;
|
---|
| 18 | readonly hotObservables: HotObservable<any>[];
|
---|
| 19 | readonly coldObservables: ColdObservable<any>[];
|
---|
| 20 | private flushTests;
|
---|
| 21 | private runMode;
|
---|
| 22 | constructor(assertDeepEqual: (actual: any, expected: any) => boolean | void);
|
---|
| 23 | createTime(marbles: string): number;
|
---|
| 24 | /**
|
---|
| 25 | * @param marbles A diagram in the marble DSL. Letters map to keys in `values` if provided.
|
---|
| 26 | * @param values Values to use for the letters in `marbles`. If ommitted, the letters themselves are used.
|
---|
| 27 | * @param error The error to use for the `#` marble (if present).
|
---|
| 28 | */
|
---|
| 29 | createColdObservable<T = string>(marbles: string, values?: {
|
---|
| 30 | [marble: string]: T;
|
---|
| 31 | }, error?: any): ColdObservable<T>;
|
---|
| 32 | /**
|
---|
| 33 | * @param marbles A diagram in the marble DSL. Letters map to keys in `values` if provided.
|
---|
| 34 | * @param values Values to use for the letters in `marbles`. If ommitted, the letters themselves are used.
|
---|
| 35 | * @param error The error to use for the `#` marble (if present).
|
---|
| 36 | */
|
---|
| 37 | createHotObservable<T = string>(marbles: string, values?: {
|
---|
| 38 | [marble: string]: T;
|
---|
| 39 | }, error?: any): HotObservable<T>;
|
---|
| 40 | private materializeInnerObservable;
|
---|
| 41 | expectObservable(observable: Observable<any>, subscriptionMarbles?: string): ({
|
---|
| 42 | toBe: observableToBeFn;
|
---|
| 43 | });
|
---|
| 44 | expectSubscriptions(actualSubscriptionLogs: SubscriptionLog[]): ({
|
---|
| 45 | toBe: subscriptionLogsToBeFn;
|
---|
| 46 | });
|
---|
| 47 | flush(): void;
|
---|
| 48 | /** @nocollapse */
|
---|
| 49 | static parseMarblesAsSubscriptions(marbles: string, runMode?: boolean): SubscriptionLog;
|
---|
| 50 | /** @nocollapse */
|
---|
| 51 | static parseMarbles(marbles: string, values?: any, errorValue?: any, materializeInnerObservables?: boolean, runMode?: boolean): TestMessage[];
|
---|
| 52 | run<T>(callback: (helpers: RunHelpers) => T): T;
|
---|
| 53 | }
|
---|