26 lines
901 B
Swift
26 lines
901 B
Swift
|
|
import Testing
|
||
|
|
@testable import NotifierCore
|
||
|
|
|
||
|
|
struct BannerPermissionTests {
|
||
|
|
@Test func deniedWarnsAndNamesTheSettingToChange() {
|
||
|
|
let warning = BannerPermission(authorizationRawValue: 1).warning
|
||
|
|
#expect(warning?.contains("System Settings") == true)
|
||
|
|
}
|
||
|
|
|
||
|
|
@Test func notDeterminedSaysItIsWaiting() {
|
||
|
|
#expect(BannerPermission(authorizationRawValue: 0).warning?.contains("Waiting") == true)
|
||
|
|
}
|
||
|
|
|
||
|
|
@Test func authorizedStatusesStayQuiet() {
|
||
|
|
for raw in [2, 3, 4] {
|
||
|
|
#expect(BannerPermission(authorizationRawValue: raw) == .allowed)
|
||
|
|
#expect(BannerPermission(authorizationRawValue: raw).warning == nil)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
@Test func anUnrecognizedStatusIsUnknownAndStaysQuiet() {
|
||
|
|
#expect(BannerPermission(authorizationRawValue: 99) == .unknown)
|
||
|
|
#expect(BannerPermission(authorizationRawValue: 99).warning == nil)
|
||
|
|
}
|
||
|
|
}
|