Replies: 1 comment
-
We can add value resetting if you know a simple way. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We can add value resetting if you know a simple way. |
Beta Was this translation helpful? Give feedback.
-
I've noticed cleanStores doesn't "reset" the store to it's initial state after exiting a test, due to state living outside of React I think this could be a good thing. It seems to act more just like an
unmount
util to clean up afterkeepMount()
.Though I think the naming is confusing as I believed this would also dump the stores so the state would be "rebuilt" as a new copy on the next test.
I think it's worth first noting this behavior explicitly in the docs -- that it will not rebuild the store -- for clarity
Then, I think it's worth considering either 2 functions.
unmount()
andcleanStores()
, add a new sort ofdumpStores()
or something but that still leaves the naming ofcleanStores()
confusing, or make the first argument ofcleanStores()
take options. Obviously all have tradeoffs and there may be more desirable options.FWIW, confusions aside, I think it's nice to have this functionality wrapped into a function without having to build your own
resetMyStore()
actions, which I do, but not every store warrants one. Especially when we're talking about Atoms and not Maps as having a reset action for every Atom probably doesn't serve any other functional purpose and would be very verbose.Beta Was this translation helpful? Give feedback.
All reactions