Skip to content

Commit

Permalink
Add SideEffect tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Qata committed Jul 27, 2021
1 parent 0d4d99b commit eee4ad4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Tests/RecombineTests/StoreDispatchTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,18 @@ class ObservableStoreDispatchTests: XCTestCase {
)
}

func testSerialDispatchWithCollect() throws {
func testSerialDispatchWithCollectWithSideEffects() throws {
var sideEffected = ""

let store = BaseStore(
state: "",
reducer: reducer,
thunk: thunk,
sideEffect: .init {
$0.flatMap { [$0, $0] }.forEach {
sideEffected += $0
}
},
publishOn: ImmediateScheduler.shared
)

Expand Down Expand Up @@ -163,5 +170,10 @@ class ObservableStoreDispatchTests: XCTestCase {
try wait(for: refinedActionsRecorder.next(), timeout: 10),
value.map { String($0) }
)

XCTAssertEqual(
sideEffected,
value.map { String($0) + String($0) }.joined()
)
}
}

0 comments on commit eee4ad4

Please sign in to comment.