test-observables.js 1.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
import { Observable } from 'rxjs';
import { getTestScheduler } from './scheduler';
import { TestScheduler } from 'rxjs/testing';
import { HotObservable } from 'rxjs/internal/testing/HotObservable';
import { ColdObservable } from 'rxjs/internal/testing/ColdObservable';
export class TestColdObservable extends Observable {
    constructor(marbles, values, error) {
        super();
        this.marbles = marbles;
        this.values = values;
        this.error = error;
        const scheduler = getTestScheduler();
        const messages = TestScheduler.parseMarbles(marbles, values, error, undefined, true);
        const cold = new ColdObservable(messages, scheduler);
        this.source = cold;
        scheduler.coldObservables.push(cold);
    }
    getSubscriptions() {
        return this.source['subscriptions'];
    }
}
export class TestHotObservable extends Observable {
    constructor(marbles, values, error) {
        super();
        this.marbles = marbles;
        this.values = values;
        this.error = error;
        const scheduler = getTestScheduler();
        const messages = TestScheduler.parseMarbles(marbles, values, error, undefined, true);
        const hot = new HotObservable(messages, scheduler);
        this.source = hot;
        scheduler.hotObservables.push(hot);
    }
    getSubscriptions() {
        return this.source['subscriptions'];
    }
}
//# sourceMappingURL=test-observables.js.map