Skip to content

Commit 86d67e6

Browse files
committed
Make store isolation tests more resillient.
1 parent 7129114 commit 86d67e6

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

Package.resolved

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tests/ComposableArchitectureTests/StoreTests.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,11 +1227,13 @@ final class StoreTests: BaseTCATestCase {
12271227
} withDependencies: {
12281228
$0.continuousClock = clock
12291229
}
1230-
store1.send(.tap)
1231-
store2.send(.tap)
1230+
let task1 = store1.send(.tap)
1231+
let task2 = store2.send(.tap)
12321232
try await Task.sleep(for: .seconds(1))
12331233
store2.send(.cancelButtonTapped)
1234-
await clock.run(timeout: .seconds(1))
1234+
await clock.advance()
1235+
await task1.finish()
1236+
await task2.finish()
12351237
XCTAssertEqual(store1.count, 42)
12361238
XCTAssertEqual(store2.count, 0)
12371239
}
@@ -1252,7 +1254,7 @@ final class StoreTests: BaseTCATestCase {
12521254
await store1.send(.tap)
12531255
await store2.send(.tap)
12541256
await store2.send(.cancelButtonTapped)
1255-
await clock.run()
1257+
await clock.advance()
12561258
await store1.receive(\.response) {
12571259
$0.count = 42
12581260
}
@@ -1280,7 +1282,7 @@ final class StoreTests: BaseTCATestCase {
12801282
return .none
12811283
case .tap:
12821284
return .run { send in
1283-
try await clock.sleep(for: .seconds(1))
1285+
try await clock.sleep(for: .seconds(0))
12841286
await send(.response(42))
12851287
}
12861288
.cancellable(id: CancelID.effect)

0 commit comments

Comments
 (0)