1010import Combine
1111import CombineRex
1212import Foundation
13- import SwiftRex
13+ @ testable import SwiftRex
1414import XCTest
1515
1616#if swift(>=5.4)
@@ -219,7 +219,7 @@ public enum Step<ActionType, StateType>: StepProtocol {
219219
220220extension XCTestCase {
221221 #if swift(>=5.4)
222- public func assert< M: Middleware > (
222+ public func assert< M: MiddlewareProtocol > (
223223 initialValue: M . StateType ,
224224 reducer: Reducer < M . InputActionType , M . StateType > ,
225225 middleware: M ,
@@ -238,7 +238,7 @@ extension XCTestCase {
238238 )
239239 }
240240
241- public func assert< M: Middleware > (
241+ public func assert< M: MiddlewareProtocol > (
242242 initialValue: M . StateType ,
243243 reducer: Reducer < M . InputActionType , M . StateType > ,
244244 middleware: M ,
@@ -259,7 +259,7 @@ extension XCTestCase {
259259 }
260260 #endif
261261
262- public func assert< M: Middleware > (
262+ public func assert< M: MiddlewareProtocol > (
263263 initialValue: M . StateType ,
264264 reducer: Reducer < M . InputActionType , M . StateType > ,
265265 middleware: M ,
@@ -278,7 +278,7 @@ extension XCTestCase {
278278 )
279279 }
280280
281- public func assert< M: Middleware > (
281+ public func assert< M: MiddlewareProtocol > (
282282 initialValue: M . StateType ,
283283 reducer: Reducer < M . InputActionType , M . StateType > ,
284284 middleware: M ,
@@ -298,7 +298,7 @@ extension XCTestCase {
298298 )
299299 }
300300
301- private func assert< M: Middleware > (
301+ private func assert< M: MiddlewareProtocol > (
302302 initialValue: M . StateType ,
303303 reducer: Reducer < M . InputActionType , M . StateType > ,
304304 middleware: M ,
@@ -329,16 +329,15 @@ extension XCTestCase {
329329 """ , file: file, line: line)
330330 }
331331
332- var afterReducer : AfterReducer = . doNothing( )
333332 let action = action ( )
334- middleware. handle (
333+ let io = middleware. handle (
335334 action: action,
336335 from: . init( file: " \( file) " , function: " " , line: line, info: nil ) ,
337- afterReducer : & afterReducer
336+ state : { state }
338337 )
339338 reducer. reduce ( action, & state)
340339 #if DEBUG
341- afterReducer . performBlock ( )
340+ io . runIO ( anyActionHandler )
342341 #else
343342 XCTFail ( " Please run the tests in DEBUG otherwise after reducer won't be called " )
344343 #endif
@@ -363,15 +362,14 @@ extension XCTestCase {
363362 let first = middlewareResponses. removeFirst ( )
364363 XCTAssertTrue ( action ( first) , file: file, line: line)
365364
366- var afterReducer : AfterReducer = . doNothing( )
367- middleware. handle (
365+ let io = middleware. handle (
368366 action: first,
369367 from: . init( file: " \( file) " , function: " " , line: line, info: nil ) ,
370- afterReducer : & afterReducer
368+ state : { state }
371369 )
372370 reducer. reduce ( first, & state)
373371 #if DEBUG
374- afterReducer . performBlock ( )
372+ io . runIO ( anyActionHandler )
375373 #else
376374 XCTFail ( " Please run the tests in DEBUG otherwise after reducer won't be called " )
377375 #endif
0 commit comments