Following this post I've decided to write a marble test for this operator.
Here is a basic test:
it('Test lossy zip', () => {
const a = hot('a---a--------a-');
const b = hot('--b----b---b---');
const observable = zip(
a.pipe(take(1)),
b.pipe(take(1))
).pipe(
mergeMapTo(from(['1'])),
repeat()
);
const expected = cold('--1----1-----1-');
expect(observable).toBeObservable(expected);
});
This test passes as expected. However, when I decide to fire two emissions, like this, it fails:
const a = hot('a---a--------a-');
const b = hot('--b----b---b---');
const observable = zip(
a.pipe(take(1)),
b.pipe(take(1))
).pipe(
mergeMapTo(from(['1', '2'])), //Here, emitting two items instead of one
repeat()
);
I would expect the resulting observable to look like this:
const expected = cold('--(12)----(12)-----(12)-');
Or at least like this:
const expected = cold('--12---12----12-');
However both of them fail.
Is it a bug in jasmine-marbles
or my expectations are wrong?