test: cover macos location permission status

This commit is contained in:
Peter Steinberger
2026-01-04 18:46:57 +01:00
parent 50cecd8210
commit 5dcf43d6ad
2 changed files with 14 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
import Testing
import ClawdbotIPC
import CoreLocation
@testable import Clawdbot
@Suite(.serialized)
@@ -22,4 +23,16 @@ struct PermissionManagerTests {
let ensured = await PermissionManager.ensure(caps, interactive: false)
#expect(ensured.keys.count == caps.count)
}
@Test func locationStatusMatchesAuthorizationAlways() async {
let status = CLLocationManager().authorizationStatus
let results = await PermissionManager.status([.location])
#expect(results[.location] == (status == .authorizedAlways))
}
@Test func ensureLocationNonInteractiveMatchesAuthorizationAlways() async {
let status = CLLocationManager().authorizationStatus
let ensured = await PermissionManager.ensure([.location], interactive: false)
#expect(ensured[.location] == (status == .authorizedAlways))
}
}