@tdb/util
Version:
Shared helpers and utilities.
33 lines • 1.12 kB
JavaScript
;
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);
});
});
//# sourceMappingURL=libs.test.js.map