UNPKG

1.81 kBTypeScriptView Raw
1/// <reference types="rx-lite-virtualtime" />
2
3declare namespace Rx {
4 interface TestScheduler extends VirtualTimeScheduler<number, number> {
5 createColdObservable<T>(...records: Recorded[]): Observable<T>;
6 createHotObservable<T>(...records: Recorded[]): Observable<T>;
7 createObserver<T>(): MockObserver<T>;
8
9 startWithTiming<T>(
10 create: () => Observable<T>,
11 createdAt: number,
12 subscribedAt: number,
13 disposedAt: number,
14 ): MockObserver<T>;
15 startWithDispose<T>(create: () => Observable<T>, disposedAt: number): MockObserver<T>;
16 startWithCreate<T>(create: () => Observable<T>): MockObserver<T>;
17 }
18
19 const TestScheduler: {
20 new(): TestScheduler;
21 };
22
23 class Recorded {
24 constructor(time: number, value: any, equalityComparer?: (x: any, y: any) => boolean);
25 equals(other: Recorded): boolean;
26 toString(): string;
27 time: number;
28 value: any;
29 }
30
31 const ReactiveTest: {
32 created: number;
33 subscribed: number;
34 disposed: number;
35
36 onNext(ticks: number, value: any): Recorded;
37 onError(ticks: number, exception: any): Recorded;
38 onCompleted(ticks: number): Recorded;
39
40 subscribe(subscribeAt: number, unsubscribeAt?: number): Subscription;
41 };
42
43 class Subscription {
44 constructor(subscribeAt: number, unsubscribeAt?: number);
45 equals(other: Subscription): boolean;
46 }
47
48 interface MockObserver<T> extends Observer<T> {
49 messages: Recorded[];
50 }
51
52 interface MockObserverStatic extends ObserverStatic {
53 new<T>(scheduler: IScheduler): MockObserver<T>;
54 }
55
56 const MockObserver: MockObserverStatic;
57}
58
59declare module "rx-lite-testing" {
60 export = Rx;
61}
62
\No newline at end of file