Questions tagged [rxjs-marbles]

rxjs-marbles is an RxJS marble testing library that should be compatible with any test framework. It wraps the RxJS TestScheduler and provides methods similar to the helper methods used the TestScheduler API.

53 questions
0
votes
2 answers

How to write unit test for effect when it fails in angular

I have loadUserCacheRequestEffect$ effect loadUserCacheRequestEffect$ = createEffect(() => this.actions$.pipe( ofType(ActionTypes.USER_SESSION_CACHE_REQUEST), switchMap(() => this.taskCacheKeyService.getCacheUserSessionData() .pipe( …
dev verma
  • 671
  • 1
  • 9
  • 18
0
votes
1 answer

How to test complex ngrx/rxjs service with jest and optionally with marbles

I'm new to javascript testing, and I can't find clear examples to learn how to test these kinds of methods. I clearly need some help here please! Here are the two methods I'm trying to test : public _getSearch(search: Search): Observable < any[] >…
lordyoum
  • 511
  • 4
  • 15
0
votes
1 answer

How to write marble test for this custom RxJS operator used in redux-observalbe Epic

I need to write marble test for my custom operator used in this loadEpic epic - this helps me to avoid problems that action INITIALiZE sometimes is dispatched to late and i getting LOAD_FAILURE: loadEpic: Epic
0
votes
1 answer

RxJS testing: marble test confusing case

I'm adding unit testing to my angular/rxjs project, and I'm using the marble test solution. And since I'm using the newer version of rxjs, so I used the build-in "TestScheduler" module. I'm following this post:…
Chris Bao
  • 2,418
  • 8
  • 35
  • 62
0
votes
3 answers

RxJS BehaviorSubject getValue inconsistency after value emitted (while testing in Jest)

I don't understand why .getValue() returns the default value of the Observable and not the last value emitted. When testing the Observable, it correctly returns the emitted value. class TestA { readonly aSource: BehaviorSubject = new…
Marçal Juan
  • 1,302
  • 14
  • 20
0
votes
0 answers

Marble-Testing doesn't use filter operator

EDIT I boiled down the problem. The following code yields an error in tests, but works as expected in the browser (see https://github.com/prumand/jest-marbles-merge-map and https://github.com/ReactiveX/rxjs/issues/4837) tests: returns a…
prumand
  • 160
  • 10
0
votes
1 answer

How do I check for anonymous functions?

I have the following in an Epic: mergeMap(result => concat( of(fetchDone(result)), of(dispatchActions(payload)) )) And actions: const fetchDone = result => ({ type: "FETCH_DONE", payload: result }); function dispatchActions(payload) { return…
NJB
  • 51
  • 4
-1
votes
1 answer

Figure out rxjs marble tests in Angular

I would like to test a service with the help of marble tests. The basic service looks like this: interface User { name: string; } @Injectable({ providedIn: 'root', }) export class ServiceToTest { public get user$(): Observable
1 2 3
4