How to use the rxjs-marbles/jest.observe 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 / jest / observe-spec.ts View on Github external
describe("observe", () => {
  it(
    "should support tests that return an observable",
    observe(() => {
      return of(1).pipe(
        map(value => value.toString()),
        tap(value => expect(typeof value).toEqual("string"))
      );
    })
  );

  it(
    "should handle assertions in finalize operator",
    observe(() => {
      const mock = jest.fn();
      return of(1).pipe(
        tap(() => mock()),
        finalize(() => expect(mock).toHaveBeenCalled())
      );
    })
  );
});