Extract BLE and chat architecture policies (#1324)

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
This commit is contained in:
jack
2026-06-02 09:01:59 +02:00
committed by GitHub
co-authored by jack
parent 193cfdc06a
commit 3eb4f2bd72
46 changed files with 3286 additions and 786 deletions
@@ -0,0 +1,40 @@
import CoreBluetooth
import Testing
@testable import bitchat
struct ChatBluetoothAlertPolicyTests {
@Test
func poweredOffShowsAlertMessage() {
let update = ChatBluetoothAlertPolicy.update(for: .poweredOff)
#expect(update.isPresented)
#expect(update.message?.isEmpty == false)
}
@Test
func unauthorizedShowsAlertMessage() {
let update = ChatBluetoothAlertPolicy.update(for: .unauthorized)
#expect(update.isPresented)
#expect(update.message?.isEmpty == false)
}
@Test
func poweredOnHidesAndClearsAlertMessage() {
let update = ChatBluetoothAlertPolicy.update(for: .poweredOn)
#expect(!update.isPresented)
#expect(update.message == "")
}
@Test
func transientStatesHideWithoutChangingAlertMessage() {
let unknown = ChatBluetoothAlertPolicy.update(for: .unknown)
let resetting = ChatBluetoothAlertPolicy.update(for: .resetting)
#expect(!unknown.isPresented)
#expect(unknown.message == nil)
#expect(!resetting.isPresented)
#expect(resetting.message == nil)
}
}