From 2ab2c6a1f5bd011e2c05e3fe82785070cbd874a2 Mon Sep 17 00:00:00 2001
From: Dariusz Rybicki <dariusz@elixxir.io>
Date: Wed, 20 Jul 2022 11:46:33 +0100
Subject: [PATCH] Add DownloadAndVerifySignedNdf functor

---
 ....swift => DownloadAndVerifySignedNdf.swift} | 18 ++++++++----------
 .../{Legacy => }/Environment.swift             |  0
 2 files changed, 8 insertions(+), 10 deletions(-)
 rename Sources/ElixxirDAppsSDK/{Legacy/NDFDownloader.swift => DownloadAndVerifySignedNdf.swift} (61%)
 rename Sources/ElixxirDAppsSDK/{Legacy => }/Environment.swift (100%)

diff --git a/Sources/ElixxirDAppsSDK/Legacy/NDFDownloader.swift b/Sources/ElixxirDAppsSDK/DownloadAndVerifySignedNdf.swift
similarity index 61%
rename from Sources/ElixxirDAppsSDK/Legacy/NDFDownloader.swift
rename to Sources/ElixxirDAppsSDK/DownloadAndVerifySignedNdf.swift
index fed33850..2c6ba075 100644
--- a/Sources/ElixxirDAppsSDK/Legacy/NDFDownloader.swift
+++ b/Sources/ElixxirDAppsSDK/DownloadAndVerifySignedNdf.swift
@@ -1,6 +1,7 @@
 import Bindings
+import XCTestDynamicOverlay
 
-public struct NDFDownloader {
+public struct DownloadAndVerifySignedNdf {
   public var run: (Environment) throws -> Data
 
   public func callAsFunction(_ env: Environment) throws -> Data {
@@ -8,8 +9,8 @@ public struct NDFDownloader {
   }
 }
 
-extension NDFDownloader {
-  public static let live = NDFDownloader { env in
+extension DownloadAndVerifySignedNdf {
+  public static let live = DownloadAndVerifySignedNdf { env in
     var error: NSError?
     let data = BindingsDownloadAndVerifySignedNdfWithUrl(
       env.url.absoluteString,
@@ -26,11 +27,8 @@ extension NDFDownloader {
   }
 }
 
-#if DEBUG
-extension NDFDownloader {
-  public static let failing = NDFDownloader { _ in
-    struct NotImplemented: Error {}
-    throw NotImplemented()
-  }
+extension DownloadAndVerifySignedNdf {
+  public static let unimplemented = DownloadAndVerifySignedNdf(
+    run: XCTUnimplemented("\(Self.self)")
+  )
 }
-#endif
diff --git a/Sources/ElixxirDAppsSDK/Legacy/Environment.swift b/Sources/ElixxirDAppsSDK/Environment.swift
similarity index 100%
rename from Sources/ElixxirDAppsSDK/Legacy/Environment.swift
rename to Sources/ElixxirDAppsSDK/Environment.swift
-- 
GitLab