Felix
Felix

Reputation: 4595

RxJS Marble testing: expectObservable vs toBeObservable

What is the difference between:

expectObservable(e1.merge(e2)).toBe(expected);

and

expect(e1.merge(e2)).toBeObservable(expected);

syntax?

Is it matter of a testing library or just a flavor?

Upvotes: 3

Views: 3698

Answers (2)

Chris Bao
Chris Bao

Reputation: 2888

Based on my usage: toBeObservable is from third party library, jasmine-marbles

expectObservable is from build in rxjs module: TestScheduler.

Upvotes: 2

dav1d
dav1d

Reputation: 2336

Seems like the official repos use a .toBeObservable matcher.

https://github.com/synapse-wireless-labs/jasmine-marbles/blob/master/spec/integration.spec.ts

https://github.com/cartant/rxjs-marbles

Not sure why the RxJS documentation uses expectObservable()

Upvotes: 1

Related Questions