From 790da3abc9af93ad626baac1d4ac9952982f513e Mon Sep 17 00:00:00 2001
From: Dariusz Rybicki <dariusz@elixxir.io>
Date: Tue, 8 Nov 2022 21:07:23 +0100
Subject: [PATCH] Remove e2eId param from GetNotificationsReport

---
 .../Functions/GetNotificationsReport.swift    |  9 +++----
 .../MessengerGetNotificationReport.swift      |  5 ----
 .../MessengerGetNotificationReportTests.swift | 24 +------------------
 3 files changed, 4 insertions(+), 34 deletions(-)

diff --git a/Sources/XXClient/Functions/GetNotificationsReport.swift b/Sources/XXClient/Functions/GetNotificationsReport.swift
index 7984285a..81d54a59 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 6de0ead8..a7f04ff9 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 236cfae7..eed49be1 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 }
-- 
GitLab