Skip to content

Testing run effect using WithTaskGroup/async let #1506

Answered by mbrandonw
PorterHoskins asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @PorterHoskins, this is definitely a bit of a blind spot in the library right now, and this exact use case was one of the motivating reasons we started a forum discussion that sadly didn't really go anywhere.

Stephen and I have discussed potentially adding a receive method on TestStore that allows you to receive multiple actions in any order. It might look like this:

await store.send(.buttonTapped)
await store.receive(inAnyOrder: [.responseA, .responseB]) {
  // state assertion
}

This could help with testing parallel effects that can emit in any order. It still wouldn't be a 100% solution because if the mutations that happen in .responseA and .responseB overlap at all, then the order o…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PorterHoskins
Comment options

Answer selected by PorterHoskins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants