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

Refactor

Rename MessengerGetNotificationReport to MessengerGetNotificationReports
parent 065dbc91
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.
import XXClient
import XCTestDynamicOverlay
public struct MessengerGetNotificationReport {
public struct MessengerGetNotificationReports {
public enum Error: Swift.Error, Equatable {
case serviceListMissing
}
......@@ -13,9 +13,9 @@ public struct MessengerGetNotificationReport {
}
}
extension MessengerGetNotificationReport {
public static func live(_ env: MessengerEnvironment) -> MessengerGetNotificationReport {
MessengerGetNotificationReport { notificationCSV in
extension MessengerGetNotificationReports {
public static func live(_ env: MessengerEnvironment) -> MessengerGetNotificationReports {
MessengerGetNotificationReports { notificationCSV in
guard let serviceList = env.serviceList() else {
throw Error.serviceListMissing
}
......@@ -27,8 +27,8 @@ extension MessengerGetNotificationReport {
}
}
extension MessengerGetNotificationReport {
public static let unimplemented = MessengerGetNotificationReport(
extension MessengerGetNotificationReports {
public static let unimplemented = MessengerGetNotificationReports(
run: XCTUnimplemented("\(Self.self)")
)
}
......@@ -47,7 +47,7 @@ public struct Messenger {
public var sendFile: MessengerSendFile
public var receiveFile: MessengerReceiveFile
public var trackServices: MessengerTrackServices
public var getNotificationReport: MessengerGetNotificationReport
public var getNotificationReports: MessengerGetNotificationReports
}
extension Messenger {
......@@ -99,7 +99,7 @@ extension Messenger {
sendFile: .live(env),
receiveFile: .live(env),
trackServices: .live(env),
getNotificationReport: .live(env)
getNotificationReports: .live(env)
)
}
}
......@@ -152,6 +152,6 @@ extension Messenger {
sendFile: .unimplemented,
receiveFile: .unimplemented,
trackServices: .unimplemented,
getNotificationReport: .unimplemented
getNotificationReports: .unimplemented
)
}
......@@ -4,7 +4,7 @@ import XCTestDynamicOverlay
import XXClient
@testable import XXMessengerClient
final class MessengerGetNotificationReportTests: XCTestCase {
final class MessengerGetNotificationReportsTests: XCTestCase {
func testGetReport() throws {
let serviceList = MessageServiceList.stub()
let notificationCSV = "notification-csv"
......@@ -27,9 +27,9 @@ final class MessengerGetNotificationReportTests: XCTestCase {
))
return notificationReports
}
let getReport: MessengerGetNotificationReport = .live(env)
let getReports: MessengerGetNotificationReports = .live(env)
let reports = try getReport(notificationCSV: notificationCSV)
let reports = try getReports(notificationCSV: notificationCSV)
XCTAssertNoDifference(didGetNotificationsReport, [
.init(
......@@ -44,11 +44,11 @@ final class MessengerGetNotificationReportTests: XCTestCase {
var env: MessengerEnvironment = .unimplemented
env.e2e.get = { .unimplemented }
env.serviceList.get = { nil }
let getReport: MessengerGetNotificationReport = .live(env)
let getReports: MessengerGetNotificationReports = .live(env)
XCTAssertThrowsError(try getReport(notificationCSV: "")) { error in
XCTAssertThrowsError(try getReports(notificationCSV: "")) { error in
XCTAssertNoDifference(
error as? MessengerGetNotificationReport.Error,
error as? MessengerGetNotificationReports.Error,
.serviceListMissing
)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment