Skip to content

Commit 4387eb8

Browse files
committed
Use expectation fulfillment in testDebug. (#181)
1 parent c744de4 commit 4387eb8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Tests/ComposableArchitectureTests/ReducerTests.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ final class ReducerTests: XCTestCase {
9595
struct State: Equatable { var count = 0 }
9696

9797
var logs: [String] = []
98+
let logsExpectation = self.expectation(description: "logs")
99+
logsExpectation.expectedFulfillmentCount = 2
98100

99101
let reducer = Reducer<State, Action, Void> { state, action, _ in
100102
switch action {
@@ -109,6 +111,7 @@ final class ReducerTests: XCTestCase {
109111
DebugEnvironment(
110112
printer: {
111113
logs.append($0)
114+
logsExpectation.fulfill()
112115
}
113116
)
114117
}
@@ -123,7 +126,7 @@ final class ReducerTests: XCTestCase {
123126
.send(.noop)
124127
)
125128

126-
_ = XCTWaiter.wait(for: [self.expectation(description: "wait")], timeout: 1.0)
129+
self.wait(for: [logsExpectation], timeout: 2)
127130

128131
XCTAssertEqual(
129132
logs,

0 commit comments

Comments
 (0)