From eee4ad476de614f454c4d551c40de039113d01b5 Mon Sep 17 00:00:00 2001 From: Charles Maria Tor Date: Tue, 27 Jul 2021 10:35:38 +1000 Subject: [PATCH] Add SideEffect tests --- Tests/RecombineTests/StoreDispatchTests.swift | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Tests/RecombineTests/StoreDispatchTests.swift b/Tests/RecombineTests/StoreDispatchTests.swift index 73fedc5..69a969d 100644 --- a/Tests/RecombineTests/StoreDispatchTests.swift +++ b/Tests/RecombineTests/StoreDispatchTests.swift @@ -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 ) @@ -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() + ) } }