Questions tagged [jasmine-marbles]

89 questions
1
vote
1 answer

rxjs-marbles testing has no expectations

I use rxjs-marbles for testing observables in my Angular 7 app. But it looks like m.expect is not recognized by jasmine as expectation. I have following test: it('should see expectations', marbles(m => { const source: Observable =…
Martin Nuc
  • 5,604
  • 2
  • 42
  • 48
1
vote
1 answer

Issue when testing ngrx effects with jest and jasmine-marbles

I'm using jest and jasmine-marbles to test my ngrx-effects. So far so good, but I have a special case where I need to use withLatestFrom to access the Store inside an effect like this: @Effect() createDataSourceSuccess$ = this.actions$ …
Szabolcs
  • 3,990
  • 18
  • 38
1
vote
1 answer

NgRx Marbles Testing of an Effect returns weird error

I have an Angular 5 app that uses NgRx Effects. One of the Effects handles Signup to a website by passing data entered by the user to a NodeJS Backend. The Effect works exactly as intended but when I try to unit test it with Marbles, I get a weird…
Alex Verzea
  • 421
  • 1
  • 11
  • 30
0
votes
0 answers

Angular testing: Empty result with jasmine-marbles for toBeObservable

We have an Angular project are using the NGRX store. That store has some effectsThe are basically all working the same way: trigger action -> API call -> success action. The API calls are all done, using auto generated API Clients (they are all…
Woozar
  • 1,000
  • 2
  • 11
  • 35
0
votes
0 answers

Test RXJS pipe/tap/map/catcherror/finalize

I am currently trying to switch from using subscribes regularly(unneeded) to using pipe together with multiple Rxjs operators such as tap,map,catchError,Finalize to fetch my data from the service. Somehow my unit tests can't reach the code inside…
0
votes
0 answers

RxJS marble test fail with operator delay()

I have the following test, it works... import { TestScheduler } from 'rxjs/internal/testing/TestScheduler'; describe('RxJx', () => { const testScheduler = new TestScheduler((actual, expected) => { console.log('works here?'); …
0
votes
1 answer

How to write a marble test for a combineLatest Observable?

I have an observable that takes two Observable and runs an "or" operation on them with combineLatest. interface LoadingEventEmitter { isLoading$: Observable } export class LoadingService { isLoading$: Observable; …
Allan Juan
  • 2,048
  • 1
  • 18
  • 42
0
votes
0 answers

ngrx jasmine-marbles test resulting the "Received" part returning '?' question mark

I am having an issue with the following tech-stack: Angular v8, ionic Angular v5, ngrx v8, jasmine-marbles v0.8.3. I am writing a unit test for "ngrx", in particular the "effects" part. Following is my code snippet: import { TestBed } from…
0
votes
1 answer

Testing BehaviorSubject with RxJS Marble

I have a problem with testing BehaviorSubject using rxjs marble. Minimal reproduction: scheduler.run(({ expectObservable }) => { const response$ = new BehaviorSubject(1); expectObservable(response$).toBe('ab', { a: 1, b: 2 }); …
Adam Waz
  • 21
  • 2
0
votes
2 answers

Jasmine tests always failing in RxJS 7 when using toBeObservable()

I've updated my dependencies and am now confronted with this error message: DEPRECATION: The matcher factory for "toBeObservable" accepts custom equality testers, but this parameter will no longer be passed in a future release. See…
user3817008
  • 613
  • 7
  • 13
0
votes
1 answer

Testing values changed by observable responses in Angular

If I want to test the following code even: boolean; ngOnInit( this.myService.obs.subscribe(response: number => { if (response % 2 === 0){ this.even = true } else {this.even = false} }); ) for the value of this.even, something like this in my…
0
votes
2 answers

unit testing using jasmine marbles

I am trying to do a simple test using jasmine-marbles but getting errors This is my test code: describe('MarbleTestingComponent', () => { it('should test marble syntax', () => { const provided = search('e'); const expected = cold('(e|)',…
nshathish
  • 417
  • 8
  • 23
0
votes
2 answers

Should we avoid nested rxjs operators? One case which I cannot test

I have written the following effect in my Angular app which uses rxjs. On MyActions.myAction, I receive an object containing a property ids - an array of ids - and for each id I want to send an HTTP request via this.myApiService.getResource, which…
0
votes
1 answer

NGRX effect not executing when running tests using Jasmine marbles

Hi I am new to NGRX and am trying to write tests for the effects I have created, however it looks like the effect function is never actually running. The effect I am trying to test is: compelteAuthentication$ = createEffect(() =>…
0
votes
1 answer

How should I write my single run RxJs code so that I can test against subscription leaks?

with this code: select(): void { this.initialObservable$ .pipe( first(), switchMap(() => this.service.getData()) ).subscribe(// do stuff); } I just experienced a memory leak bug. the…
Craig
  • 1,648
  • 1
  • 20
  • 45