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
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

Cannot run the simplest rxjs-marbles tests

On a completely fresh install of ng new myapp (cli version 1.6.8, Angular 5.2.0, rxjs 5.5.6), I installed rxjs marbles. I am having problem running the very basic test for some configuration reasons. Can any one tell me what went wrong? import {…
user776686
  • 7,933
  • 14
  • 71
  • 124
0
votes
0 answers

How to test Observables using RxJS marbles

I am trying to test an Observable using RxJS marbles. the following is my code: at point x i want to login and at point y i want to add new invoices to my list. The problem is, that it always says that there are already invoices at frame…
timmmmmb
  • 674
  • 7
  • 26
0
votes
1 answer

RXJS Marble Testing TestScheduler not flushing observable and wrong expectation for Angular Jasmine Unit Test

I am trying to learn how to rxjs marble test using testScheduler. When trying to test a behavior subject getter and setter I get the error Expected spy setVersatilityRowOptions to have been called with:[ VersatilityHeaderRowOptions({…
0
votes
0 answers

Unit Testing retryWhen using rxjs marbles + Jest

I have this RxJS function, which first calls foo.methodOne(), which returns an Observable, and then calls bar.methodTwo(), which also returns an Observable. bar.methodTwo() can fail every so often, so I needed to add retry logic to…
Siddhu
  • 888
  • 3
  • 9
  • 28
0
votes
0 answers

combineLatest with marble syntax

So I faced a problem when trying to test combineLatest result I am facing an error. const e1 = hot('^--a--|'); const e2 = hot('^---b-|'); const expected = cold('--(ab)-|'); expect(combineLatest([e1,…
Kraken
  • 1,905
  • 12
  • 22
0
votes
0 answers

Why time-related operations of rxjs marbles testing does not work in Jest with ESM?

I found that rxjs marbles tests failed on jest esm when using time-related(e,g. delay) operators. Check the test case here: https://github.com/jaohaohsuan/jest-preset-angular/commit/259b2361d37609e8a409bce96c953603739ef1cb Does anyone have this…
Henry Jao
  • 1
  • 1
0
votes
0 answers

Weired Marbles error -?-| but result is correct

I am testing my effect with marble diagram but i always get error without any details while the result is correct. Here is my test for the effect : I dispatch action with details and i expect the effect to return the "expected action" with new…
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

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
1 answer

How to execute an observable conditionally? (Depending on a variable state in class level)

Can someone tell me if there is a clean way to return an observable conditionally, depending on a pre-defined condition? Let us consider the following scenario, isEditing = false; // <---- This is a variable defined in the class level return…
CodeR_Ax20
  • 91
  • 1
  • 8
0
votes
1 answer

RxJs: Execute a long running function immediately after returning, giving the caller an Observable for updates

I have a function that could be considered long running (actually, it's multi-step where each step could be waiting for an external event like a response from a HTTP call). There's an invoker function to this which should return an observable that…
Sameera
  • 1,025
  • 13
  • 36
0
votes
2 answers

Rxjs marble testing : how to simulate user interaction with observables

I want to test an Angular service, I will simplify my case in order to make it straightforward : I have a behaviorSubject bound to an observable in my service @Injectable({ providedIn: 'root', }) export class MyService { readonly username =…
0
votes
1 answer

Redux-observable Testing and losing my Marbles

I want to test this observable but I get NOTHING back from it: const fetchUsersApi = (action$: any) => action$.pipe( ofType(FETCH_USERS), mergeMap(() => from( API.graphql(graphqlOperation(queries.LIST_ALL_USERS)), ).pipe( …
pip
  • 453
  • 2
  • 13
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…