UNPKG

@tdb/util

Version:
33 lines (32 loc) 1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var chai_1 = require("chai"); var rxjs_1 = require("rxjs"); var operators_1 = require("rxjs/operators"); describe('libs.rxjs', function () { it('piping', function () { var Foo = (function () { function Foo() { this._disposed$ = new rxjs_1.Subject(); this._events$ = new rxjs_1.Subject(); this.events$ = this._events$.pipe(operators_1.takeUntil(this._disposed$), operators_1.share()); } Foo.prototype.next = function () { this._events$.next(); }; Foo.prototype.dispose = function () { this._disposed$.next(); }; return Foo; }()); var count = 0; var foo = new Foo(); foo.events$.subscribe(function () { return count++; }); foo.next(); foo.next(); chai_1.expect(count).to.eql(2); foo.dispose(); foo.next(); chai_1.expect(count).to.eql(2); }); });