[Unit testing RxJS] Test synchronous operations
const { TestScheduler } = require("rxjs/testing");
const { map, take } = require("rxjs/operators");
const { concat, from } = require("rxjs");
describe("Marble testing in Rxjs", () => {
let testScheduler;
beforeEach(() => {
testScheduler = new TestScheduler((actual, expected) => {
expect(actual).toEqual(expected);
});
});
it("should let you test asychronous operations", () => {
testScheduler.run((helpers) => {
const { expectObservable } = helpers;
const source$ = from([1, 2, 3]);
const expected = "(abc|)";
expectObservable(source$).toBe(expected, { a: 1, b: 2, c: 3 });
});
});
});