Skip to content
Discussion options

You must be logged in to vote

Hi @andtie, the finish method on TestStore is specifically for waiting for inflight effects to finish, and really is just a kludge due to the flakiness of async tests in Swift in general. In your test, you don't have any inflight effects. The synchronous effect that delivers indirect was processed right away.

It seems what you are looking for is the skipReceivedActions, which does accomplish what you want:

await store.send(.direct)
await store.skipReceivedActions()
XCTAssertEqual(store.state.count, 1)  // ✅

Since this is not an issue with the library I am going to convert it to a discussion, and feel free to follow up with any questions.

Replies: 1 comment 1 reply

Comment options

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

Answer selected by andtie
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
Converted from issue

This discussion was converted from issue #2240 on June 29, 2023 18:55.