Combine RxJS marble diagrams

252 Views Asked by At

I'm testing an observable that might be described with following diagram:

-a(bcdef) // emit one value at first frame and 5 values in second frame
--g       // emit one value at third frame

But I cannot describe this observable in single diagram, which is expected by function expectObservable().toBe

When I write a diagram like below:

-a(bcdef)g

g appears to be in 9th frame, but I want the value to appear in the 3rd frame.

I also tried to use combineLatest to combine multiple diagrams into single one like below, following this suggestion

const values = {a, b, c, d, e, f, g };
const expected1$ = cold('-a(bcdef)', {a, b, c, d, e, f  });
const expected2$ = cold('--g', { g });

const expected$ = combineLatest([
  expected1$,
  expected2$
]);

but unfortunately I've got an error.

Please advice how to test this case with marbles and if it's even possible to combine expected marbles?

0

There are 0 best solutions below