Rxjs: TestScheduler: flush method is crashing when validate observables

Created on 24 Mar 2016  路  5Comments  路  Source: ReactiveX/rxjs

RxJS version: 5.0.0.beta.3

Code to reproduce:

 let ts = new Rx.TestScheduler();
 let expected = '--a--b--c--|';
 let values = {
        a: 0,
        b: 2,
        c: 44
    }
 let o = ts.createColdObservable('--a----b--c--|', values);
 ts.expectObservable(o).toBe(expected, values);
 ts.flush()

Expected behavior:
observables validation

Actual behavior:
failed with "this.assertDeepEqual is not a function"

Additional information:
I think the error is on the definition of assertDeepEqual used inside flush method.
When I try to replace your implementation importing assert module and using assert.deepEqual, the flush method was working correctly validating my observables

Most helpful comment

FWIW: in the short term, you could use lodash's _.isEqual like:

new TestScheduler((a, b) => _.isEqual(a, b))

that should solve your issue.

I'm going to close this for now. Please reopen or open another issue if you continue to have a problem.

All 5 comments

This is because currently testscheulder requires to inject deep equal assertion via ctor

constructor(public assertDeepEqual: (actual: any, expected: any) => boolean | void) {

and test case in RxJS fulfills it via its helper (test-helper). Have you tried to provide assertion via ctor? Does it not work still?

not tried yet but for which reason did you decide to inject the assertion?

not tried yet but for which reason did you decide to inject the assertion?

Because we can't assume what testing harness you're using, and each testing harness has a different means of deeply asserting two values to be equal.

FWIW: in the short term, you could use lodash's _.isEqual like:

new TestScheduler((a, b) => _.isEqual(a, b))

that should solve your issue.

I'm going to close this for now. Please reopen or open another issue if you continue to have a problem.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LittleFox94 picture LittleFox94  路  3Comments

haf picture haf  路  3Comments

unao picture unao  路  4Comments

samherrmann picture samherrmann  路  3Comments

jakovljevic-mladen picture jakovljevic-mladen  路  3Comments