Skip to content

Commit 31aca10

Browse files
committed
Added test of desired accuracy setting.
1 parent b5a0401 commit 31aca10

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Tests/AsyncLocationKitTests/AsyncLocationKitTests.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,21 @@ import CoreLocation
33
@testable import AsyncLocationKit
44

55
final class AsyncLocationKitTests: XCTestCase {
6-
let locationManager = AsyncLocationManager(locationManager: MockLocationManager(), desiredAccuracy: .bestAccuracy)
6+
static let mockLocationManager = MockLocationManager()
7+
8+
func testDesiredAccuracy() {
9+
let firstAccuracy: LocationAccuracy = .nearestTenMetersAccuracy
10+
let locationManager = AsyncLocationManager(locationManager: AsyncLocationKitTests.mockLocationManager, desiredAccuracy: firstAccuracy)
11+
XCTAssertTrue(AsyncLocationKitTests.mockLocationManager.desiredAccuracy == firstAccuracy.convertingAccuracy)
12+
13+
let secondAccuracy: LocationAccuracy = .bestForNavigationAccuracy
14+
locationManager.updateAccuracy(with: secondAccuracy)
15+
XCTAssertTrue(AsyncLocationKitTests.mockLocationManager.desiredAccuracy == secondAccuracy.convertingAccuracy)
16+
}
717

818
func testRequestLocation() async {
919
do {
20+
let locationManager = AsyncLocationManager(locationManager: AsyncLocationKitTests.mockLocationManager)
1021
let location = try await locationManager.requestLocation()
1122

1223
switch location {

0 commit comments

Comments
 (0)