Component store test documentation #4044
Closed
BrunoRoese
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Recently, I was working on a project using Angular v15 and NgRx. Everything worked fine, and I was utilizing the new component store lifecycle and lazy state initialization. However, when I needed to write unit tests for my component store, I encountered very little documentation on that, especially when dealing with the recently added lifecycles.
The only comprehensive article I found on this topic was this one: https://medium.com/@rogerg93/how-to-unit-test-the-ngrx-component-store-in-angular-3ad395a21cbd, but it doesn't cover the new features.
With that being said, when running unit tests for my component store with lazy state initialization, I couldn't find a way to resolve this warning:
console.warn @ngrx/component-store: MyComponentStore has the OnStoreInit lifecycle hook(s) implemented without being provided using the provideComponentStore() function. To resolve this, provide the component store via provideComponentStore().
Is this a known bug, or was I missing something? I found a discussion on a similar issue, but it had been closed: #3937.
Is there any reason why there is no documentation on unit tests in the component store section? Wouldn't it be a great idea to include some documentation on that?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions