File tree Expand file tree Collapse file tree 2 files changed +27
-4
lines changed
Sources/ComposableArchitecture
Tests/ComposableArchitectureTests Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -2114,10 +2114,6 @@ extension TestStore {
2114
2114
file: file,
2115
2115
line: line
2116
2116
)
2117
-
2118
- for effect in self . reducer. inFlightEffects {
2119
- _ = EffectPublisher < Never , Never > . cancel ( id: effect. id) . sink { _ in }
2120
- }
2121
2117
self . reducer. inFlightEffects = [ ]
2122
2118
}
2123
2119
Original file line number Diff line number Diff line change @@ -404,6 +404,33 @@ final class TestStoreTests: BaseTCATestCase {
404
404
$0. date = now
405
405
}
406
406
}
407
+
408
+ func testEffectEmitAfterSkipInFlightEffects( ) async {
409
+ let mainQueue = DispatchQueue . test
410
+ enum Action : Equatable { case tap, response }
411
+ let store = TestStore (
412
+ initialState: 0 ,
413
+ reducer: Reduce< Int, Action> { state, action in
414
+ switch action {
415
+ case . tap:
416
+ return . run { send in
417
+ try await mainQueue. sleep ( for: . seconds( 1 ) )
418
+ await send ( . response)
419
+ }
420
+ case . response:
421
+ state = 42
422
+ return . none
423
+ }
424
+ }
425
+ )
426
+
427
+ await store. send ( . tap)
428
+ await store. skipInFlightEffects ( )
429
+ await mainQueue. advance ( by: . seconds( 1 ) )
430
+ await store. receive ( . response) {
431
+ $0 = 42
432
+ }
433
+ }
407
434
}
408
435
409
436
private struct Client : DependencyKey {
You can’t perform that action at this time.
0 commit comments