You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ ] 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:
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 expect(TestBed.get(EffectsClass)).toBeDefined() when TestBed imports an entire store module.
This PR exposes a method to get metadata supplied
through @effect() decorator.
This method is useful for when we want to test
that an effect was properly decorated/registered
in the store.
Related issue: ngrx#491
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://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:
The text was updated successfully, but these errors were encountered: