Skip to content

Commit

Permalink
Merge branch 'master' into feature/DTPOMERSER-1001_Add_privacy_manife…
Browse files Browse the repository at this point in the history
…st_on_cocoapods
  • Loading branch information
grmeyer-hw-dev committed Jul 7, 2024
2 parents abd2678 + cfc4fd2 commit ec90f60
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
fail-fast: false
matrix:
include:
- os: macos-13
xcode_version: 15.2
- os: macos-12
xcode_version: 14.2
fastlane_task: unit_tests

runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class AuthenticationTokenProvider: HyperwalletAuthenticationTokenProvider
let task = defaultSession.dataTask(with: request) {(data, response, error) in
DispatchQueue.main.async {
guard let data = data,
let clientToken = String(data: data, encoding: .utf8),
let clientToken = String(decoding: data, as: UTF8.self),
let response = response as? HTTPURLResponse else {
completionHandler(nil, HyperwalletAuthenticationErrorType.unexpected(error?.localizedDescription ??
"authentication token cannot be retrieved"))
Expand Down
4 changes: 2 additions & 2 deletions Tests/AnyCodableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AnyCodableTests: XCTestCase {

// Then
XCTAssertNotNil(jsonBody)
let jsonBodyString = String(data: jsonBody, encoding: .utf8)!
let jsonBodyString = String(decoding: jsonBody, as: UTF8.self)
XCTAssertTrue(((jsonBodyString.contains("USD"))))
}

Expand Down Expand Up @@ -69,7 +69,7 @@ class AnyCodableTests: XCTestCase {

func testDecode_arraySupportedTypes() {
// Given
let jsonBody = "[1, \"String\", 1.2, true, null]".data(using: .utf8)!
let jsonBody = Data("[1, \"String\", 1.2, true, null]".utf8)

// When
let result = try! JSONDecoder().decode(Array<AnyCodable>.self, from: jsonBody)
Expand Down
10 changes: 5 additions & 5 deletions Tests/HTTPTransactionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ class HTTPTransactionTests: XCTestCase {
func testPerformGraphQl_emptyResponseData_returnNilDataAndGraphQlErrors() {
// Given - SDK is initialized

let graphQlResponse = """
let graphQlResponse = Data("""
{}
""".data(using: .utf8)
""".utf8)
var response: Connection<HyperwalletTransferMethodConfiguration>?
var hyperwalletError: HyperwalletErrorType?

Expand Down Expand Up @@ -248,7 +248,7 @@ class HTTPTransactionTests: XCTestCase {
currency: "ARS",
transferMethodType: "BANK_ACCOUNT",
profile: "INDIVIDUAL")
httpClientMock.data = "{}".data(using: .utf8)
httpClientMock.data = Data("{}".utf8)
httpClientMock.urlResponse = HTTPURLResponse(url: URL(string: "http://localhost")!,
statusCode: 403,
httpVersion: "post",
Expand Down Expand Up @@ -305,7 +305,7 @@ class HTTPTransactionTests: XCTestCase {
var response: [String: String]?
var hyperwalletError: HyperwalletErrorType?

httpClientMock.data = "{}".data(using: .utf8)
httpClientMock.data = Data("{}".utf8)
httpClientMock.urlResponse = HTTPURLResponse(url: URL(string: "http://localhost")!,
statusCode: 403,
httpVersion: "post",
Expand Down Expand Up @@ -632,7 +632,7 @@ class HTTPTransactionTests: XCTestCase {

let requestHandler = HTTPTransaction.requestHandler(completionHandler)

requestHandler("{}".data(using: .utf8)!, urlResponse, nil)
requestHandler(Data("{}".utf8), urlResponse, nil)

// Then
XCTAssertNil(response, "The response should be null")
Expand Down
4 changes: 2 additions & 2 deletions Tests/Helper/HTTPClientMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import Foundation
class HTTPClientMock: HTTPClientProtocol {
var hasPerformed = false
var request: URLRequest?
var data: Data? = "{}".data(using: .utf8)
var data: Data? = Data("{}".utf8)
var urlResponse: URLResponse?
var error: Error?

/// Resets mock status
func reset() {
hasPerformed = false
request = nil
data = "{}".data(using: .utf8)
data = Data("{}".utf8)
urlResponse = nil
error = nil
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/TransactionTypeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ class TransactionTypeTests: XCTestCase {
if httpMethod == .get {
XCTAssertNil(urlRequest.httpBody, "The HTTP body should be nil")
} else {
let httpBody = String(data: urlRequest.httpBody!, encoding: .utf8)
let httpBody = String(decoding: urlRequest.httpBody!, as: UTF8.self)
let payloadData = try JSONEncoder().encode(payload)
let payloadString = String(data: payloadData, encoding: .utf8)
let payloadString = String(decoding: payloadData, as: UTF8.self)
XCTAssertEqual(httpBody, payloadString, "The HTTP body should be equals to payload")
}

Expand Down Expand Up @@ -165,7 +165,7 @@ class TransactionTypeTests: XCTestCase {
if httpMethod == .get {
XCTAssertNil(urlRequest.httpBody, "The HTTP body should be nil")
} else {
let query = String(data: urlRequest.httpBody!, encoding: .utf8)
let query = String(decoding: urlRequest.httpBody!, as: UTF8.self)
let payloadString = payload.toGraphQl(userToken: configuration.userToken)
XCTAssertEqual(query, payloadString, "The HTTP body should be equals to payload")
}
Expand Down

0 comments on commit ec90f60

Please sign in to comment.