Fork me on GitHub

Hello, I'm just starting with Reagent/ClojureScript, but have experience with React dev and JavaScript. I'm doing some small projects to try and get a hang of it, and I was wondering, what's the recommended practice for testing code that uses a global r/atom to hold the state? I mean, how do you reset the state in between tests of functions that manipulate that state? The functions just use state, which is required to the various namespaces.


you can use with-redefs to override what the var is within each test, and it will reset it once done with that test


note that if you tests are asynchronous with-redefs doesn't play well


thank you! I'll try that now