In my app I wish to assert that notifications have been added in the correct format. I\'d normally do this with dependency injection, but I can\'t think of a way to test the new
You can utilize UNUserNotificationCenter
, then setValue
on the returned settings
UNUserNotificationCenter.current().getNotificationSettings(completionHandler: { settings in
let status: UNAuthorizationStatus = .authorized
settings.setValue(status.rawValue, forKey: "authorizationStatus")
completionHandler(settings)
})