Skip to content

Commit 5d741bf

Browse files
authored
Use expectation fulfillment in testDebug. (#181)
1 parent d20505c commit 5d741bf

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
@@ -101,6 +101,8 @@ final class ReducerTests: XCTestCase {
101101
struct State: Equatable { var count = 0 }
102102

103103
var logs: [String] = []
104+
let logsExpectation = self.expectation(description: "logs")
105+
logsExpectation.expectedFulfillmentCount = 2
104106

105107
let reducer = Reducer<State, Action, Void> { state, action, _ in
106108
switch action {
@@ -115,6 +117,7 @@ final class ReducerTests: XCTestCase {
115117
DebugEnvironment(
116118
printer: {
117119
logs.append($0)
120+
logsExpectation.fulfill()
118121
}
119122
)
120123
}
@@ -129,7 +132,7 @@ final class ReducerTests: XCTestCase {
129132
.send(.noop)
130133
)
131134

132-
_ = XCTWaiter.wait(for: [self.expectation(description: "wait")], timeout: 0.1)
135+
self.wait(for: [logsExpectation], timeout: 2)
133136

134137
XCTAssertEqual(
135138
logs,

0 commit comments

Comments
 (0)