Skip to content

Commit f6d0f06

Browse files
committed
add test to verify behaviour
1 parent edb2f0c commit f6d0f06

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

CriticalMapsKit/Tests/AppFeatureTests/AppFeatureCoreTests.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,23 @@ final class AppFeatureTests: XCTestCase {
439439
XCTAssertTrue(val)
440440
}
441441
}
442+
443+
func test_postLocation_shouldNotPostLocationWhenObserverModeIsEnabled() async {
444+
var state = AppFeature.State()
445+
state.settingsState.userSettings.isObservationModeEnabled = true
446+
447+
let store = TestStore(
448+
initialState: state,
449+
reducer: AppFeature()
450+
)
451+
store.dependencies.date = .init({ @Sendable in self.date() })
452+
453+
let location = ComposableCoreLocation.Location(
454+
coordinate: .init(latitude: 11, longitude: 21),
455+
timestamp: Date(timeIntervalSince1970: 2)
456+
)
457+
await store.send(.postLocation)
458+
}
442459
}
443460

444461
// MARK: Helper

0 commit comments

Comments
 (0)