Closed djalexd closed 10 months ago
For those ending up here from Google:
A) This is the chai-rx module for RxJS 4. For RxJS 5 and up head on over here: https://github.com/hellosmithy/chai-rx#readme
B) The schedulers aren't supposed to be chained, they are supposed to wrap the observable under test.
let sourceUnderTest = Rx.Observable.from([1,2,3,4]).map(x => x*2);
let scheduler = new Rx.TestScheduler();
testStream$ = scheduler.startScheduler(() => sourceUnderTest);
expect(testStream$).to.emit([
onNext(200, 2),
onNext(200, 4),
onNext(200, 6),
onNext(200, 8),
onCompleted(200),
]);
Sorry years late on this, but README now updated to reflect this.
The following code works without any problems (rxjs5+)
However, if there is any kind of operation performed on the source, plugin no longer works. The following code doesn't work:
It also fails with very cryptic error message, but in reality the plugin is unable to assert the actual object, because it relies on
obj.messages
(see https://github.com/hellosmithy/chai-rx/blob/master/src/chai-rx.js#L10) which is no longer defined when chaining.I don't know how to fix this without a subscription (but even then, tests look ugly).
imho not being able to chain observables severely limits the function of this plugin.