How to use the rxjs-marbles/tape.fakeSchedulers function in rxjs-marbles

To help you get started, we’ve selected a few rxjs-marbles examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cartant / rxjs-marbles / examples / tape / fake-spec.ts View on Github external
import { fakeSchedulers } from "rxjs-marbles/tape";
import { of, timer } from "rxjs";
import { delay } from "rxjs/operators";
import * as sinon from "sinon";
import * as tape from "tape";

tape(
  "it should support a timer",
  fakeSchedulers(t => {
    t.plan(2);
    const clock: sinon.SinonFakeTimers = sinon.useFakeTimers();
    let received: number | undefined;
    timer(100).subscribe(value => (received = value));
    clock.tick(50);
    t.equals(received, undefined);
    clock.tick(50);
    t.equals(received, 0);
    clock.restore();
  })
);

tape(
  "it should support delay",
  fakeSchedulers(t => {
    t.plan(2);