Non-exhaustive testing and stale TestStore state #2001
Replies: 2 comments 2 replies
-
Hi @RandomActsOfCode, you are correct that state is not updated in the test store until actions are received. We do, however, provide a tool to force receiving all pending actions: await store.skipReceivedActions() And we have a test that demonstrates how to use the tool. Does that help with your situation? |
Beta Was this translation helpful? Give feedback.
-
I'm having the same trouble - the I suspect this might be because I'm sending multiple effects from a single action and using one of my dependencies to control when those actions get sent - the effect actually uses a dependency that returns an So in effect I have: await store.send(.startsComplexEffect)
continuation.yield(.firstEvent) // will trigger a single action
await store.skipReceivedActions()
continuation.yield(.lastEvent) // will trigger multiple actions
continuation.finish()
await store.skipReceivedActions() // I expect this to skip the actions sent after the effect receives `.lastEvent`
await store.finish() // wait for the effect to finish Unfortunately this fails with an error on the original |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have been experimenting with non-exhaustive testing to see if it be can
leveraged to create end-to-end tests with fully live dependencies and features.
The idea would be to create "user journey" based workflows in tests where view
actions are feed into the system and the mutated state asserted on at
various checkpoints. Similar to a UI automation test but without the GUI
clicking:
I thought non-exhaustive testing would be a good fit since the intermediate
internal effects don't need to be explicitly captured. However, I am
experiencing stale state on the
TestStore
as illustrated by the two tests inthis trivial example:
The problem is an
Action
needs to be received to flush the lateststate
butthere isn't an
Action
at the same abstraction level that can be receivedeasily (in the real app). For example, the real
authSuccessful
action hasassociated types:
I am wondering if there way to manually update the
TestStore
's state withoutan explicit action? I was hoping for something like
testStore.receive()
but couldnot find this or something similar.
Beta Was this translation helpful? Give feedback.
All reactions