Initial value test with BehaviorSubject fails
See original GitHub issueHi,
I have been trying to use jasmine-marbles in an Angular project but the following test is failing:
it('works', () => {
const foo = new BehaviorSubject(1);
const expected = cold('a', { a: 1 });
expect(foo).toBeObservable(expected);
});
The error is as follows:
Error:
Expected: a,
Received: ?,
Expected:
[{"frame":0,"notification":{"kind":"N","value":1,"hasValue":true}}]
Received:
[{"frame":0,"notification":{"kind":"N","value":1}}],
The same test using TestScheduler as follows works:
const foo = new BehaviorSubject(1);
scheduler.run((helpers) => {
helpers.expectObservable(foo).toBe('a', { a: 1 });
});
Any suggestions?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
RxJS BehaviorSubject getValue inconsistency after value ...
getValue() returns the default value of the Observable and not the last value emitted. When testing the Observable, it correctly returns the ...
Read more >Testing of BehaviorSubject with seed or first null value #170
I can't seem to test properly that BehaviorSubject emits null value first, either with add method or with seed value.
Read more >Angular Unit Testing BehaviorSubject Karma Jamsine
Then you need to trigger the behavior subject with a value and validate the same value in the data variable in component.
Read more >Testing Components depending on Services - Testing Angular
We declare a variable fakeCount$ in the scope of the test suite and assign a BehaviorSubject in the first beforeEach block: describe(' ...
Read more >Understanding rxjs BehaviorSubject, ReplaySubject and ...
We first create a subject and subscribe to that with Subscriber A. The Subject then emits it's value and Subscriber A will log...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@qdelettre My bad, I confirm this works fine when downgrading to 0.8.3.
0.2.0 supports RxJS 5.x => 0.3.* supports RxJS 6.x => 0.9.0 supports RxJS 7.x
You cannot use 0.9.0 with rxjs < 7