mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-24 23:45:18 +00:00
41 lines
1.1 KiB
Swift
41 lines
1.1 KiB
Swift
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)
|
|
}
|
|
}
|