@@ -663,22 +663,18 @@ public final class TestStore<State, Action, ScopedState, ScopedAction, Environme
663663 Environment == Void
664664 {
665665 var dependencies = DependencyValues . _current
666- let initialState = withDependencies {
666+ let reducer = withDependencies {
667667 prepareDependencies ( & dependencies)
668668 $0 = dependencies
669669 } operation: {
670- initialState ( )
670+ TestReducer ( Reduce ( reducer ( ) ) , initialState: initialState ( ) )
671671 }
672-
673- let reducer = TestReducer (
674- Reduce ( withDependencies ( prepareDependencies) { reducer ( ) } ) , initialState: initialState
675- )
676672 self . _environment = . init( wrappedValue: ( ) )
677673 self . file = file
678674 self . fromScopedAction = fromScopedAction
679675 self . line = line
680676 self . reducer = reducer
681- self . store = Store ( initialState: initialState , reducer: reducer)
677+ self . store = Store ( initialState: reducer . state , reducer: reducer)
682678 self . timeout = 100 * NSEC_PER_MSEC
683679 self . toScopedState = toScopedState
684680 self . dependencies = dependencies
@@ -708,22 +704,18 @@ public final class TestStore<State, Action, ScopedState, ScopedAction, Environme
708704 Environment == Void
709705 {
710706 var dependencies = DependencyValues . _current
711- prepareDependencies ( & dependencies )
712- let initialState = withDependencies {
707+ let reducer = withDependencies {
708+ prepareDependencies ( & dependencies )
713709 $0 = dependencies
714710 } operation: {
715- initialState ( )
711+ TestReducer ( Reduce ( reducer ( ) ) , initialState: initialState ( ) )
716712 }
717-
718- let reducer = TestReducer (
719- Reduce ( withDependencies ( prepareDependencies) { reducer ( ) } ) , initialState: initialState
720- )
721713 self . _environment = . init( wrappedValue: ( ) )
722714 self . file = file
723715 self . fromScopedAction = { $0 }
724716 self . line = line
725717 self . reducer = reducer
726- self . store = Store ( initialState: initialState , reducer: reducer)
718+ self . store = Store ( initialState: reducer . state , reducer: reducer)
727719 self . timeout = 100 * NSEC_PER_MSEC
728720 self . toScopedState = { $0 }
729721 self . dependencies = dependencies
0 commit comments