From f6d0f06adbc8a07f3c00251783ecb3fd4f7c7fb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20Bu=CC=88nz?= Date: Tue, 6 Jun 2023 14:55:48 +0200 Subject: [PATCH] add test to verify behaviour --- .../AppFeatureTests/AppFeatureCoreTests.swift | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CriticalMapsKit/Tests/AppFeatureTests/AppFeatureCoreTests.swift b/CriticalMapsKit/Tests/AppFeatureTests/AppFeatureCoreTests.swift index 30c10949..67285435 100644 --- a/CriticalMapsKit/Tests/AppFeatureTests/AppFeatureCoreTests.swift +++ b/CriticalMapsKit/Tests/AppFeatureTests/AppFeatureCoreTests.swift @@ -439,6 +439,23 @@ final class AppFeatureTests: XCTestCase { XCTAssertTrue(val) } } + + func test_postLocation_shouldNotPostLocationWhenObserverModeIsEnabled() async { + var state = AppFeature.State() + state.settingsState.userSettings.isObservationModeEnabled = true + + let store = TestStore( + initialState: state, + reducer: AppFeature() + ) + store.dependencies.date = .init({ @Sendable in self.date() }) + + let location = ComposableCoreLocation.Location( + coordinate: .init(latitude: 11, longitude: 21), + timestamp: Date(timeIntervalSince1970: 2) + ) + await store.send(.postLocation) + } } // MARK: Helper