UNPKG

@hirez_io/observer-spy

Version:

A simple little class that helps making Observable testing a breeze

29 lines 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fakeTime = void 0; var testing_1 = require("rxjs/testing"); function fakeTime(callback) { if (callback.length === 0) { throw new Error("\n \"fakeTime()\" callback must be declared with at least one parameter\n For example: fakeAsync((flush)=> ...)\n "); } if (callback.length === 1) { return function () { /* istanbul ignore next */ var testScheduler = new testing_1.TestScheduler(function () { }); return testScheduler.run(function (_a) { var flush = _a.flush; return callback(flush); }); }; } return function (done) { /* istanbul ignore next */ var testScheduler = new testing_1.TestScheduler(function () { }); return testScheduler.run(function (_a) { var flush = _a.flush; return callback(flush, done); }); }; } exports.fakeTime = fakeTime; //# sourceMappingURL=fake-time.js.map