Testing set functions #247
Replies: 1 comment 1 reply
-
I'm not very experienced in testing with zustand, but if I were to test functions in the store, I would define them outside and test separately. const actions = (set) => ({
increasePopulation: () => set(state => ({ bears: state.bears + 1 }))
})
const useStore = create((set) => ({
bears: 0,
...actions(set),
})) Or, I'd test react component with useStore. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Folks, any hints regarding testing set functions?
How would you go about the example functions from the repo since they obviously have side effects? i.e.:
increasePopulation: () => set(state => ({ bears: state.bears + 1 }))
Would be really grateful for any hints, stackoverflow passed on me this time :)
Beta Was this translation helpful? Give feedback.
All reactions