@@ -71,6 +71,13 @@ public struct Send<ActionType, StateType>: StepProtocol {
7171 public var asStep : Step < ActionType , StateType > {
7272 . send( action: action ( ) , file: file, line: line, stateChange: stateChange)
7373 }
74+
75+ public func expectStateToHaveChanged( _ expectedMutation: @escaping ( inout StateType ) -> Void = { _ in } ) -> Send {
76+ . init( action: action ( ) , file: file, line: line, stateChange: { state in
77+ self . stateChange ( & state)
78+ expectedMutation ( & state)
79+ } )
80+ }
7481}
7582
7683public struct Receive < ActionType, StateType> : StepProtocol {
@@ -105,6 +112,13 @@ public struct Receive<ActionType, StateType>: StepProtocol {
105112 public var asStep : Step < ActionType , StateType > {
106113 . receive( isExpectedAction: isExpectedAction, file: file, line: line, stateChange: stateChange)
107114 }
115+
116+ public func expectStateToHaveChanged( _ expectedMutation: @escaping ( inout StateType ) -> Void = { _ in } ) -> Receive {
117+ . init( isExpectedAction: isExpectedAction, file: file, line: line, stateChange: { state in
118+ self . stateChange ( & state)
119+ expectedMutation ( & state)
120+ } )
121+ }
108122}
109123
110124public struct SideEffectResult < ActionType, StateType> : StepProtocol {
0 commit comments