From 2bc19ad02324186192194a79739969ef55bb9ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20Bu=CC=88nz?= Date: Sat, 14 Sep 2024 13:46:54 +0200 Subject: [PATCH] update test --- .../AppFeatureTests/AppFeatureCoreTests.swift | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/CriticalMapsKit/Tests/AppFeatureTests/AppFeatureCoreTests.swift b/CriticalMapsKit/Tests/AppFeatureTests/AppFeatureCoreTests.swift index 335fd183..00dbbb94 100644 --- a/CriticalMapsKit/Tests/AppFeatureTests/AppFeatureCoreTests.swift +++ b/CriticalMapsKit/Tests/AppFeatureTests/AppFeatureCoreTests.swift @@ -275,17 +275,22 @@ final class AppFeatureTests: XCTestCase { } } + @MainActor func test_mapAction_focusEvent() async throws { - throw XCTSkip("Seems to have issues comparing $bottomSheetPosition") - var state = AppFeature.State() state.bottomSheetPosition = .absolute(1) + let testClock = TestClock() + let store = TestStore( initialState: state, - reducer: { AppFeature() } + reducer: { AppFeature() }, + withDependencies: { + $0.continuousClock = testClock + $0.mainQueue = .immediate + } ) - store.dependencies.mainQueue = .immediate + store.exhaustivity = .off(showSkippedAssertions: false) let coordinate = Coordinate.make() @@ -293,6 +298,7 @@ final class AppFeatureTests: XCTestCase { $0.mapFeatureState.eventCenter = CoordinateRegion(center: coordinate.asCLLocationCoordinate) } await store.receive(.binding(.set(\.$bottomSheetPosition, .relative(0.4)))) + await testClock.advance(by: .seconds(1)) await store.receive(.map(.resetRideEventCenter)) { $0.mapFeatureState.eventCenter = nil }