diff --git a/Sources/XXClient/Functions/GetNotificationsReport.swift b/Sources/XXClient/Functions/GetNotificationsReport.swift index 7984285a8cfe5aea99284c7c62e26711f7b6c94c..81d54a59e298bc8a7f5a597736ca5f494e7f07c4 100644 --- a/Sources/XXClient/Functions/GetNotificationsReport.swift +++ b/Sources/XXClient/Functions/GetNotificationsReport.swift @@ -2,23 +2,20 @@ import Bindings import XCTestDynamicOverlay public struct GetNotificationsReport { - public var run: (Int, String, MessageServiceList) throws -> NotificationReport + public var run: (String, MessageServiceList) throws -> NotificationReport public func callAsFunction( - e2eId: Int, notificationCSV: String, services: MessageServiceList ) throws -> NotificationReport { - try run(e2eId, notificationCSV, services) + try run(notificationCSV, services) } } extension GetNotificationsReport { - public static let live = GetNotificationsReport { - e2eId, notificationCSV, services in + public static let live = GetNotificationsReport { notificationCSV, services in var error: NSError? let result = BindingsGetNotificationsReport( - e2eId, notificationCSV, try services.encode(), &error diff --git a/Sources/XXMessengerClient/Messenger/Functions/MessengerGetNotificationReport.swift b/Sources/XXMessengerClient/Messenger/Functions/MessengerGetNotificationReport.swift index 6de0ead8402d7b0065f45a47c014121191fe6d39..a7f04ff91554e2982cfb082cb49a9c289985dd6f 100644 --- a/Sources/XXMessengerClient/Messenger/Functions/MessengerGetNotificationReport.swift +++ b/Sources/XXMessengerClient/Messenger/Functions/MessengerGetNotificationReport.swift @@ -3,7 +3,6 @@ import XCTestDynamicOverlay public struct MessengerGetNotificationReport { public enum Error: Swift.Error, Equatable { - case notConnected case serviceListMissing } @@ -17,14 +16,10 @@ public struct MessengerGetNotificationReport { extension MessengerGetNotificationReport { public static func live(_ env: MessengerEnvironment) -> MessengerGetNotificationReport { MessengerGetNotificationReport { notificationCSV in - guard let e2e = env.e2e() else { - throw Error.notConnected - } guard let serviceList = env.serviceList() else { throw Error.serviceListMissing } return try env.getNotificationsReport( - e2eId: e2e.getId(), notificationCSV: notificationCSV, services: serviceList ) diff --git a/Tests/XXMessengerClientTests/Messenger/Functions/MessengerGetNotificationReportTests.swift b/Tests/XXMessengerClientTests/Messenger/Functions/MessengerGetNotificationReportTests.swift index 236cfae7920e35932990585f8e2a6256a20b32aa..eed49be16789ec70d6179e9b5c0a8c5fc2e2e171 100644 --- a/Tests/XXMessengerClientTests/Messenger/Functions/MessengerGetNotificationReportTests.swift +++ b/Tests/XXMessengerClientTests/Messenger/Functions/MessengerGetNotificationReportTests.swift @@ -6,30 +6,22 @@ import XXClient final class MessengerGetNotificationReportTests: XCTestCase { func testGetReport() throws { - let e2eId = 123 let serviceList = MessageServiceList.stub() let notificationCSV = "notification-csv" let notificationReport = NotificationReport.stub() struct GetNotificationsReportParams: Equatable { - var e2eId: Int var notificationCSV: String var serviceList: MessageServiceList } var didGetNotificationsReport: [GetNotificationsReportParams] = [] var env: MessengerEnvironment = .unimplemented - env.e2e.get = { - var e2e: E2E = .unimplemented - e2e.getId.run = { e2eId } - return e2e - } env.serviceList.get = { serviceList } - env.getNotificationsReport.run = { e2eId, notificationCSV, serviceList in + env.getNotificationsReport.run = { notificationCSV, serviceList in didGetNotificationsReport.append(.init( - e2eId: e2eId, notificationCSV: notificationCSV, serviceList: serviceList )) @@ -41,7 +33,6 @@ final class MessengerGetNotificationReportTests: XCTestCase { XCTAssertNoDifference(didGetNotificationsReport, [ .init( - e2eId: e2eId, notificationCSV: notificationCSV, serviceList: serviceList ) @@ -49,19 +40,6 @@ final class MessengerGetNotificationReportTests: XCTestCase { XCTAssertNoDifference(report, notificationReport) } - func testGetReportWhenNotConnected() { - var env: MessengerEnvironment = .unimplemented - env.e2e.get = { nil } - let getReport: MessengerGetNotificationReport = .live(env) - - XCTAssertThrowsError(try getReport(notificationCSV: "")) { error in - XCTAssertNoDifference( - error as? MessengerGetNotificationReport.Error, - .notConnected - ) - } - } - func testGetReportWhenServiceListMissing() { var env: MessengerEnvironment = .unimplemented env.e2e.get = { .unimplemented }