2026-01-11 01:35:51 +01:00
|
|
|
import CoreLocation
|
|
|
|
|
import Testing
|
2026-01-30 03:15:10 +01:00
|
|
|
@testable import OpenClaw
|
2026-01-11 01:35:51 +01:00
|
|
|
|
|
|
|
|
struct PermissionManagerLocationTests {
|
2026-03-08 13:22:46 +00:00
|
|
|
@Test
|
|
|
|
|
func `authorizedAlways counts for both modes`() {
|
2026-01-11 01:35:51 +01:00
|
|
|
#expect(PermissionManager.isLocationAuthorized(status: .authorizedAlways, requireAlways: false))
|
|
|
|
|
#expect(PermissionManager.isLocationAuthorized(status: .authorizedAlways, requireAlways: true))
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 13:22:46 +00:00
|
|
|
@Test
|
|
|
|
|
func `other statuses not authorized`() {
|
2026-01-11 01:35:51 +01:00
|
|
|
#expect(!PermissionManager.isLocationAuthorized(status: .notDetermined, requireAlways: false))
|
|
|
|
|
#expect(!PermissionManager.isLocationAuthorized(status: .denied, requireAlways: false))
|
|
|
|
|
#expect(!PermissionManager.isLocationAuthorized(status: .restricted, requireAlways: false))
|
|
|
|
|
}
|
|
|
|
|
}
|