just-jeb / jest-marbles

Helpers library for marbles testing with Jest
MIT License
112 stars 13 forks source link

toEmitValue matchers #526

Open MillerSvt opened 2 months ago

MillerSvt commented 2 months ago

I suggest adding a few matchers for a narrower stream check.

const expected = cold('a', {a: value});
expect(stream).toBeObservable(value);

// replaces with

expect(stream).toEmitValueFirst(value);
const expected = cold('--a', {a: value});
expect(stream).toBeObservable(value);

// replaces with

expect(stream).toEmitValueNth(value, 3);
// there are no alternatives

expect(stream).toEmitValueLast(value);
MillerSvt commented 1 month ago

@just-jeb what do you think about it? I can do this...

just-jeb commented 1 month ago

@MillerSvt I'm not quite sure about how common this scenario is, but given that pretty much all the matchers are nothing but a syntactic sugar I don't have a strong opinion on this. So if you want to go ahead and make a PR I won't object.