From e0d960ee32e7a58a02878c438e42a54dfa167431 Mon Sep 17 00:00:00 2001 From: stechiu Date: Wed, 3 Apr 2024 14:31:33 -0700 Subject: [PATCH] Revert "Fix Failing `UnitTest`s (#1244)" This reverts commit a70059355e7033b1f3d440f9585c8dd49a990883. --- Sources/BraintreeCore/BTJSON.swift | 2 +- .../BTSEPADirectDebitClient_Tests.swift | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/BraintreeCore/BTJSON.swift b/Sources/BraintreeCore/BTJSON.swift index 5f7abbef48..fc15208f51 100644 --- a/Sources/BraintreeCore/BTJSON.swift +++ b/Sources/BraintreeCore/BTJSON.swift @@ -219,7 +219,7 @@ import Foundation /// The `BTJSON` as a `URL` /// - Returns: A `URL` representing the `BTJSON` instance public func asURL() -> URL? { - guard let urlString = value as? String, urlString.utf8.count == urlString.utf16.count else { + guard let urlString = value as? String else { return nil } return URL(string: urlString) diff --git a/UnitTests/BraintreeSEPADirectDebitTests/BTSEPADirectDebitClient_Tests.swift b/UnitTests/BraintreeSEPADirectDebitTests/BTSEPADirectDebitClient_Tests.swift index 76bb5d1060..d1fa0e53b2 100644 --- a/UnitTests/BraintreeSEPADirectDebitTests/BTSEPADirectDebitClient_Tests.swift +++ b/UnitTests/BraintreeSEPADirectDebitTests/BTSEPADirectDebitClient_Tests.swift @@ -179,6 +179,12 @@ class BTSEPADirectDebitClient_Tests: XCTestCase { ] ) + mockWebAuthenticationSession.cannedErrorResponse = NSError( + domain: BTSEPADirectDebitError.errorDomain, + code: BTSEPADirectDebitError.approvalURLInvalid.errorCode, + userInfo: ["Description": "Mock approvalURLInvalid error description."] + ) + let sepaDirectDebitClient = BTSEPADirectDebitClient( apiClient: mockAPIClient, webAuthenticationSession: mockWebAuthenticationSession,