Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
code style changes
  • Loading branch information
obj-p committed Feb 20, 2019
commit a674e51665a1c547726323ae382bfbd366c5180c
15 changes: 10 additions & 5 deletions ReSwift-ThunkTests/ExpectThunk.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,16 @@ public class ExpectThunk<State: StateType> {
}

extension ExpectThunk {
public func dispatches<A: Action & Equatable>(_ expected: A, file: StaticString = #file, line: UInt = #line) -> Self {
public func dispatches<A: Action & Equatable>(_ expected: A,
file: StaticString = #file,
line: UInt = #line) -> Self {
dispatchAssertions.append({ received in
XCTAssert(received as? A == expected, "dispatched action does not equal expected: \(received) \(expected)", file: file, line: line)
XCTAssert(
received as? A == expected,
"dispatched action does not equal expected: \(received) \(expected)",
file: file,
line: line
)
})
return self
}
Expand All @@ -61,9 +68,7 @@ extension ExpectThunk {

extension ExpectThunk {
func run() -> XCTestExpectation {
let next: DispatchFunction = { _ in }
let middleware = createThunksMiddleware()(dispatch, getState)(next)
middleware(thunk)
createThunksMiddleware()(dispatch, getState)({ _ in })(thunk)
return expectation
}
}