0
votes

I'm having problem with figuring out the way effects should be tested in Angular 4 application that are using ngrx/store etc.. For Angular2 there was EffectsRunner and EffectsTestingModule but they are not present in ngrx/store version for angular 4. I'm looking for a way to test the effects as well as whole app with store

1

1 Answers

0
votes

To test you effects with store you can provide a mock store to your TestBed:

TestBed.configureTestingModule({
        providers: [
            provideMockActions(() => actions$),
            {provide: Store, useValue: mockStore}
            ...
        ]
    });

mockStore extends BehaviorSubject and should contain a dispatch and select method.

You should take a look at the migration guide for how to test effects in ngrx v4.