Questions tagged [jasmine-marbles]
89 questions
1
vote
0 answers
Need to create unit testcase using jasmine marble in withLatestFrom
I am completely new at doing unit testing using jasmine-marble.
I have a component, with the following code:
getData() : void {
this.firstObservableClass.pipe(withLatestFrom(this.secObservableClass))
.subscribe(([firstObservResult,…

user16836526
- 19
- 1
1
vote
3 answers
How to test subscription inside method
Consider this angular component:
export class CheckoutComponent {
constructor(private paymentService: PaymentService, private paymentModalService: PaymentModalService) {}
public onCheckout(): void {
const paymentStatus$: Observable…

nomadoda
- 4,561
- 3
- 30
- 45
1
vote
1 answer
Observable with pairwise not firing in test
Trying to test a method that is using pairwise.
Method:
this.x$.pipe(pairwise()).subscribe((x) => {
const [previous, current] = x;
this.store.dispatch(actionThatIWantToFire({ appId: current }));
});
For demonstration purposes. I'm…

s.Lawrenz
- 302
- 3
- 17
1
vote
1 answer
RXJS marble test
I have a test for mergemap, But it does not return the correct expect result. Can someone help me?
Thanks!
it("should maps to inner observable and flattens", () => {
const values = { a: "hello", b: "world", x: "hello world" };
const obs1…

anary
- 131
- 1
- 1
- 5
1
vote
2 answers
Testing NGRX effect that emits action with delay OR does not emit anything
I have an NGRX effect that - depending on the state - emits an action with a delay or it emits nothing.
I want to write a test, covering both situations.
This is the effect:
myEffect$ = createEffect(() =>
this.actions$.pipe(
ofType(MyAction),
…

Jan
- 191
- 6
1
vote
1 answer
Angular NgRx integration test not working (with Nx and Jest)
I have a facade class that is using NgRx behind the curtains. The facade itself is working when I use it in my application, but via the integration tests it doesn't work (better said: the tests are not working). I am using Nx (don't think that…

johey
- 1,139
- 1
- 9
- 25
1
vote
1 answer
Angular Unit Test - nested async pipes
Consider the following code:
app.component.ts
@Component({
selector: 'app-component',
templateUrl: './app-component.html',
styleUrls: ['./app-component.scss']
})
export class AppComponent implements OnInit {
constructor(
private…

userradu
- 119
- 2
- 13
1
vote
1 answer
Jasmine-marbles - Is there a expect(...).ToHaveBeenCalledWithObservable(...) function?
Is there a way to test observable in a function arguments?
Is there any thing like expect(someObj.foo).ToHaveBeenCalledWithObservable(cold('a|', {a: 1}))?

gilad
- 15
- 5
1
vote
1 answer
How to trigger an error with 'ngrx effects' when testing with angular
Here is my effects:
getAssessmentPeriods$: Observable = createEffect(() =>
this.actions$.pipe(
ofType(courseAttributeActions.getAssessmentPeriod_CR),
switchMap(() =>…

user2024080
- 1
- 14
- 56
- 96
1
vote
0 answers
Jasmine-marble/createSpy - Cannot read property 'nativeElement' of undefined
I am writing an jasmine-marble test for my functionality, everything works fine but cold observable created is not returned :
Following is the HTML code:
-
Avdhut
- 150
- 4
- 15
1
vote
1 answer
Angular - testing Observable with Pairwise operator
I am using Angular and have been writing Unit tests for a while using jasmine-marbles. This is a scenario I can't seem to figure out. How would I test the determineNextSteps$? I am open to other solutions for testing this as well besides using…

Camden Brown
- 13
- 3
1
vote
1 answer
How to properly use jasmine-marbles to test multiple actions in ofType
I have an Effect that is called each time it recives an action of more than one "kind"
myEffect.effect.ts
someEffect$ = createEffect(() =>
this.actions$.pipe(
ofType(fromActions.actionOne, fromActions.actionTwo),
exhaustMap(() =>…

ALGDB
- 650
- 1
- 6
- 22
1
vote
1 answer
Why am i getting this error, while unit testing ngrx-effect
I'm writing unit tests for ngrx effects. I tried it all but it seems that i can't get past this error:
Expected $[0].notification.kind = 'E' to equal 'N'.
Expected $[0].notification.value = undefined to equal Object({ vendors: [ Object({ id: 1234,…

Tomazz
- 21
- 4
1
vote
1 answer
How to tell Jasmine Marbles to return an array as a single unit and not as two separate calls to observers
A Jasmine Marbles test I'm writing is calling an Observable once for each element in an array when I want it to call the Observable once and pass the entire array.
This is the test code;
it('sends an action when fetching the conversion list', () =>…

mcpierce
- 312
- 5
- 16
1
vote
0 answers
Jasmine Marbles: testing custom RXJS Operator for handling HTTP
I wrote this function here for an incremental Http retry, but I am a bit confused about how to test it:
export const incrementalHttpRetry = (delayArg: number = 500, numberOfRetries: number = 5): OperatorFunction => {
return…

Phil
- 7,065
- 8
- 49
- 91