-
-
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
RFC(@ngrx/signals
): Add unprotected
helper for testing
#4540
Comments
We could also provide a function This would have two advantages: ✅ Similarity to what people know from Angular Ofc, breaking up coupling is also possible with |
Yeah, good point but then I'd suggest to go with something like const store = injectUnprotectedStore(UsersStore);
patchState(store, setAllEntities(usersMock)) There is a perceived difference between the In order to avoid misuse, we could say, the only need for the test helper is to setup the initial state...and nothing else. In that case, we could have just const store = injectStore(UsersStore, setAllEntities(usersMock); In this case, the state stays protected for the test as well. For edge cases we could still have |
I think |
What do you mean by unintended state changes? The |
I see, there doesn’t seem to be a problem if it’s a testing plugin. |
Which @ngrx/* package(s) are relevant/related to the feature request?
signals
Information
This RFC suggests introducing the
unprotected
function that would be exported from@ngrx/signals/testing
. It would allow updating protected SignalStore's state in tests as follows:Describe any alternatives/workarounds you're currently using
No response
I would be willing to submit a PR to fix this issue
The text was updated successfully, but these errors were encountered: