cartant / rxjs-marbles

An RxJS marble testing library for any test framework

Home Page:https://cartant.github.io/rxjs-marbles/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document usage of the marbles object for deep comparisons of observables

balteo opened this issue · comments

@cartant To begin with, congratulations on this nice framework !

It would be nice to document usage of the marbles object for deep comparisons of observables.

     // Within my spec:

      function deepEqual(actual, expected) {
        fail();
      }

      m.configure({assertDeepEqual: deepEqual, assert});

      m.expect(effects$.myEffect$).toBeObservable(expected);

The above test passes (under Jasmine), indicating the deepEqual is not taken into account.

What are your thoughts?

Cheers,

This package is a thin wrapper around the testing infrastructure that's in RxJS. And, for that reason, I'm not keen on documenting it. It's working fine, just not as you expected and I don't think it's necessary to explain when and why each of the assertion methods is called.

Basically, if the arguments can be converted to marble strings, the strings are compared and that does not involve a deep comparison. assertDeepEqual is only called if conversion to marble strings isn't possible and that's why the forced failure you were expecting does not occur.

The original file is here. If you have a look at it, you'll see that I've copied it pretty much verbatim - including the license.

Thanks a lot for the clarification.