Files
openclaw/apps/ios/Tests/PermissionRequestBridgeTests.swift
Peter Steinberger 0e68c50139 fix(ios): add Photos permission controls (#99350)
* fix(ios): add Photos permission controls

* chore(i18n): sync native Photos strings

* fix(ios): align Swedish Photos disclosure

* test(ios): complete limited Photos UI proof

* chore(i18n): refresh native source lines
2026-07-02 22:11:14 -07:00

40 lines
1.3 KiB
Swift

import Photos
import Testing
@testable import OpenClaw
@Suite(.serialized) struct PermissionRequestBridgeTests {
@Test func `box resumes immediately when cancelled before install`() async {
let box = PermissionRequestBridge.Box()
box.resume(false)
let granted: Bool = await withCheckedContinuation { continuation in
_ = box.install(continuation)
}
#expect(granted == false)
#expect(box.canStartRequest() == false)
}
@Test func `box resumes installed continuation once`() async {
let box = PermissionRequestBridge.Box()
let granted: Bool = await withCheckedContinuation { continuation in
_ = box.install(continuation)
box.resume(true)
box.resume(false)
}
#expect(granted == true)
}
}
struct PhotoLibraryAccessTests {
@Test(arguments: [PHAuthorizationStatus.authorized, .limited])
func `read access includes full and limited authorization`(_ status: PHAuthorizationStatus) {
#expect(PhotoLibraryAccess.canRead(status))
}
@Test(arguments: [PHAuthorizationStatus.notDetermined, .denied, .restricted])
func `read access excludes unavailable authorization`(_ status: PHAuthorizationStatus) {
#expect(!PhotoLibraryAccess.canRead(status))
}
}