From 065dbc91122b204af3c0276315c0743fe5e12119 Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki <dariusz@elixxir.io> Date: Sat, 12 Nov 2022 11:34:01 +0100 Subject: [PATCH] Update MessengerGetNotificationReport --- .../MessengerGetNotificationReport.swift | 4 ++-- .../MessengerGetNotificationReportTests.swift | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Sources/XXMessengerClient/Messenger/Functions/MessengerGetNotificationReport.swift b/Sources/XXMessengerClient/Messenger/Functions/MessengerGetNotificationReport.swift index a7f04ff9..0b7de4fa 100644 --- a/Sources/XXMessengerClient/Messenger/Functions/MessengerGetNotificationReport.swift +++ b/Sources/XXMessengerClient/Messenger/Functions/MessengerGetNotificationReport.swift @@ -6,9 +6,9 @@ public struct MessengerGetNotificationReport { case serviceListMissing } - public var run: (String) throws -> NotificationReport + public var run: (String) throws -> [NotificationReport] - public func callAsFunction(notificationCSV: String) throws -> NotificationReport { + public func callAsFunction(notificationCSV: String) throws -> [NotificationReport] { try run(notificationCSV) } } diff --git a/Tests/XXMessengerClientTests/Messenger/Functions/MessengerGetNotificationReportTests.swift b/Tests/XXMessengerClientTests/Messenger/Functions/MessengerGetNotificationReportTests.swift index eed49be1..7d778c0d 100644 --- a/Tests/XXMessengerClientTests/Messenger/Functions/MessengerGetNotificationReportTests.swift +++ b/Tests/XXMessengerClientTests/Messenger/Functions/MessengerGetNotificationReportTests.swift @@ -8,7 +8,7 @@ final class MessengerGetNotificationReportTests: XCTestCase { func testGetReport() throws { let serviceList = MessageServiceList.stub() let notificationCSV = "notification-csv" - let notificationReport = NotificationReport.stub() + let notificationReports = [NotificationReport].stub() struct GetNotificationsReportParams: Equatable { var notificationCSV: String @@ -25,11 +25,11 @@ final class MessengerGetNotificationReportTests: XCTestCase { notificationCSV: notificationCSV, serviceList: serviceList )) - return notificationReport + return notificationReports } let getReport: MessengerGetNotificationReport = .live(env) - let report = try getReport(notificationCSV: notificationCSV) + let reports = try getReport(notificationCSV: notificationCSV) XCTAssertNoDifference(didGetNotificationsReport, [ .init( @@ -37,7 +37,7 @@ final class MessengerGetNotificationReportTests: XCTestCase { serviceList: serviceList ) ]) - XCTAssertNoDifference(report, notificationReport) + XCTAssertNoDifference(reports, notificationReports) } func testGetReportWhenServiceListMissing() { @@ -55,7 +55,13 @@ final class MessengerGetNotificationReportTests: XCTestCase { } } -extension NotificationReport { +private extension Array where Element == NotificationReport { + static func stub() -> [NotificationReport] { + [.stub(), .stub(), .stub()] + } +} + +private extension NotificationReport { static func stub() -> NotificationReport { NotificationReport( forMe: .random(), -- GitLab