How to use the rxjs-marbles/ava.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 / ava / fake-spec.ts View on Github external
import test from "ava";
import { fakeSchedulers } from "rxjs-marbles/ava";
import { of, timer } from "rxjs";
import { delay } from "rxjs/operators";
import * as sinon from "sinon";

test(
  "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.is(received, undefined);
    clock.tick(50);
    t.is(received, 0);
    clock.restore();
  })
);

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