File tree Expand file tree Collapse file tree 2 files changed +17
-9
lines changed
Sources/ComposableArchitecture
Tests/ComposableArchitectureTests Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -499,13 +499,17 @@ public final class TestStore<State, Action> {
499499 ///
500500 /// - Parameters:
501501 /// - initialState: The state the feature starts in.
502- /// - reducer: The reducer that powers the runtime of the feature.
502+ /// - reducer: The reducer that powers the runtime of the feature. Unlike
503+ /// ``Store/init(initialState:reducer:withDependencies:)``, this is _not_ a builder closure
504+ /// due to a [Swift bug](https://github.com/apple/swift/issues/72399) that is more likely to
505+ /// affect test store initialization. If you must compose multiple reducers in this closure,
506+ /// wrap them in ``CombineReducers``.
503507 /// - prepareDependencies: A closure that can be used to override dependencies that will be
504508 /// accessed during the test. These dependencies will be used when producing the initial
505509 /// state.
506510 public init < R: Reducer > (
507- initialState: @autoclosure ( ) -> R . State ,
508- @ ReducerBuilder < State , Action > reducer: ( ) -> R ,
511+ initialState: @autoclosure ( ) -> State ,
512+ reducer: ( ) -> R ,
509513 withDependencies prepareDependencies: ( inout DependencyValues ) -> Void = { _ in
510514 } ,
511515 file: StaticString = #file,
Original file line number Diff line number Diff line change 4545 let clock = TestClock ( )
4646
4747 let store = TestStore ( initialState: 0 ) {
48- Feature_testCombine_EffectsAreMerged (
49- delay: . seconds( 1 ) , setValue: { @MainActor in fastValue = 42 } )
50- Feature_testCombine_EffectsAreMerged (
51- delay: . seconds( 2 ) , setValue: { @MainActor in slowValue = 1729 } )
48+ CombineReducers {
49+ Feature_testCombine_EffectsAreMerged (
50+ delay: . seconds( 1 ) , setValue: { @MainActor in fastValue = 42 } )
51+ Feature_testCombine_EffectsAreMerged (
52+ delay: . seconds( 2 ) , setValue: { @MainActor in slowValue = 1729 } )
53+ }
5254 } withDependencies: {
5355 $0. continuousClock = clock
5456 }
9092 var second = false
9193
9294 let store = TestStore ( initialState: 0 ) {
93- Feature_testCombine ( effect: { @MainActor in first = true } )
94- Feature_testCombine ( effect: { @MainActor in second = true } )
95+ CombineReducers {
96+ Feature_testCombine ( effect: { @MainActor in first = true } )
97+ Feature_testCombine ( effect: { @MainActor in second = true } )
98+ }
9599 }
96100
97101 await store
You can’t perform that action at this time.
0 commit comments