Skip to content

Integration testing of @Effect() observables #491

@dinvlad

Description

@dinvlad

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[x] Feature request
[ ] Documentation issue or request

What is the current behavior?

One is able to unit-test individual effect observables.

Expected behavior:

We should be able to test that these observables are properly registered with the store (i.e. provide an integration test). For example, an observable may be provided and behave correctly in isolation, but a developer can forget or accidentally remove a corresponding @Effect decorator.

We should also be able to test that the decorator has been configured correctly. E.g. to test that "dispatch: false" was set.

Although we can indeed instantiate the "real" store and subscribe to its Actions, actions returned from effects in this way don't get "immediately" dispatched in a test. As a result, it is unclear how to "wait" until a particular effect "settled down" before testing whether this effect resulted in a dispatch of a new action, or whether no dispatch happened (if "dispatch: false").

If that's possible to achieve with the current implementation, could you provide an example how to?

Minimal reproduction of the problem with instructions:

https://github.com/ngrx/platform/blob/master/example-app/app/auth/effects/auth.effects.ts

Version of affected browser(s),operating system(s), npm, node and ngrx:

any

Other information:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions