-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration testing of @Effect() observables #491
Comments
As a possible solution, we could expose platform/modules/effects/src/effects_metadata.ts Lines 42 to 45 in 100a8ef
getSourceMetadata() returns all of the necessary information to enable these tests.
Moreover, we can then get by with simple unit tests, and the integration test will consist of a single Currently, we can import { getSourceMetadata } from '@ngrx/effects/src/effects_metadata'; but I assume that is not reliable as it's not exposed through the API? |
I'm submitting a...
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:/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:
The text was updated successfully, but these errors were encountered: