Is there any way to run intents multiple times in ...
# orbit-mvi
k
Is there any way to run intents multiple times in debug mode to verify that they don't have side effects (aka idempotent) like you can do with redux reducers or Mavericks?
m
I suggest just unit testing them, if they produce side effects that are not declared in the assertion it should fail the test.
k
Then all the unit tests would have to do the run twice check probably. Mostly curious whether it's possible since it seems to be a common thing checked for in redux/MVI frameworks...
m
I am curious - why twice?
I’m guessing by side effects you do not mean the ones you send to the view?
k
I think they check that reducers are "pure" https://airbnb.io/mavericks/#/debug-checks
So this isn't running the intent handler twice but reduce {} is done twice in debug mode.
m
I see, makes sense. We don’t currently have this, but we’ll consider building something like this in
👍 1
you can always wrap a unit test in
repeat(5) { … }
in the meantime 😅
unless this relies on having the same container for both reductions
also, I wonder if the idempotency check done by mavericks isn’t a fairly weak test anyway, as the reduction might appear idempotent for some input states, but not for others 🤔
k
I think it requires the container so that's why it's a runtime check vs. a unit test rule.
m
unit tests run on the container as well
well - in a way
k
True..hmm... Not sure why it couldn't be implemented as a unit test rule then 🤔
m
testing using real world use cases and data might be one reason
but this can be done in tests using fixtures
k
Or if people forget to do tests...
😅 2
m
“forget”
🙂 2