import Foundation import Testing @testable import Notifying @Suite("AppNotification model") struct AppNotificationTests { // MARK: Initializers @Suite("Initializers") struct Initializers { @Test(arguments: zip( [AppNotification.Kind.error, .info, .warning], ["An error occurred.", "Something happened.", "Something needs attention."] )) func `initializer stores the given kind, message, and symbol`( kind: AppNotification.Kind, message: String ) { let notification = AppNotification( kind: kind, message: message, symbol: "bell" ) #expect(notification.kind == kind) #expect(notification.message == message) #expect(notification.symbol == "bell") } @Test func `initializer stores the given identifier`() { let id = UUID() let notification = AppNotification( id: id, kind: .info, message: "Something happened.", symbol: "bell" ) #expect(notification.id == id) } } // MARK: Equatable @Suite("Equatable") struct EquatableConformance { @Test func `notifications with the same identifier and values are equal`() { let id = UUID() let first = AppNotification( id: id, kind: .info, message: "Something happened.", symbol: "bell" ) let second = AppNotification( id: id, kind: .info, message: "Something happened.", symbol: "bell" ) #expect(first == second) } @Test func `notifications with generated identifiers are never equal`() { let first = AppNotification( kind: .info, message: "Something happened.", symbol: "bell" ) let second = AppNotification( kind: .info, message: "Something happened.", symbol: "bell" ) #expect(first != second) } } }