Skip to content
Snippets Groups Projects
Commit 065dbc91 authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Update MessengerGetNotificationReport

parent 86e5199c
No related branches found
No related tags found
2 merge requests!142Fix GetNotificationsReport,!102Release 1.0.0
This commit is part of merge request !142. Comments created here will be created in the context of that merge request.
...@@ -6,9 +6,9 @@ public struct MessengerGetNotificationReport { ...@@ -6,9 +6,9 @@ public struct MessengerGetNotificationReport {
case serviceListMissing 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) try run(notificationCSV)
} }
} }
......
...@@ -8,7 +8,7 @@ final class MessengerGetNotificationReportTests: XCTestCase { ...@@ -8,7 +8,7 @@ final class MessengerGetNotificationReportTests: XCTestCase {
func testGetReport() throws { func testGetReport() throws {
let serviceList = MessageServiceList.stub() let serviceList = MessageServiceList.stub()
let notificationCSV = "notification-csv" let notificationCSV = "notification-csv"
let notificationReport = NotificationReport.stub() let notificationReports = [NotificationReport].stub()
struct GetNotificationsReportParams: Equatable { struct GetNotificationsReportParams: Equatable {
var notificationCSV: String var notificationCSV: String
...@@ -25,11 +25,11 @@ final class MessengerGetNotificationReportTests: XCTestCase { ...@@ -25,11 +25,11 @@ final class MessengerGetNotificationReportTests: XCTestCase {
notificationCSV: notificationCSV, notificationCSV: notificationCSV,
serviceList: serviceList serviceList: serviceList
)) ))
return notificationReport return notificationReports
} }
let getReport: MessengerGetNotificationReport = .live(env) let getReport: MessengerGetNotificationReport = .live(env)
let report = try getReport(notificationCSV: notificationCSV) let reports = try getReport(notificationCSV: notificationCSV)
XCTAssertNoDifference(didGetNotificationsReport, [ XCTAssertNoDifference(didGetNotificationsReport, [
.init( .init(
...@@ -37,7 +37,7 @@ final class MessengerGetNotificationReportTests: XCTestCase { ...@@ -37,7 +37,7 @@ final class MessengerGetNotificationReportTests: XCTestCase {
serviceList: serviceList serviceList: serviceList
) )
]) ])
XCTAssertNoDifference(report, notificationReport) XCTAssertNoDifference(reports, notificationReports)
} }
func testGetReportWhenServiceListMissing() { func testGetReportWhenServiceListMissing() {
...@@ -55,7 +55,13 @@ final class MessengerGetNotificationReportTests: XCTestCase { ...@@ -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 { static func stub() -> NotificationReport {
NotificationReport( NotificationReport(
forMe: .random(), forMe: .random(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment