TestStore received unexpected action, due to naming collision?
johankool opened this issue · 0 comments
johankool commented
Description
Attached is a sample project that shows a failing test that says "Received unexpected action" but the action it names is as expected.
await store.receive(\.something) // Received unexpected action: … Feature.Action.something(true)
It seems this only happens if the Action conforms to BindableAction. It also happens if the action has no associated object. I could only work around it by changing the name of either the action or the state property.
@ObservableState
struct State: Equatable {
var something: Bool = false
}
enum Action: BindableAction {
case binding(BindingAction<State>)
case onAppear
case something(Bool)
}
Checklist
- I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
- If possible, I've reproduced the issue using the
main
branch of this package. - This issue hasn't been addressed in an existing GitHub issue or discussion.
Expected behavior
Test to pass.
Actual behavior
Test fails.
Steps to reproduce
See attached project.
TestCasePath.zip
The Composable Architecture version information
1.9.0
Destination operating system
iOS 17.2
Xcode version information
Version 15.2 (15C500b)
Swift Compiler version information
swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx14.0