From 4f5fb61bfd16dd1e77a2399e29f693d4dd6af00a Mon Sep 17 00:00:00 2001 From: Arthur Semenyutin Date: Sun, 15 May 2022 22:12:05 +1000 Subject: [PATCH 1/2] Enable linux tests --- .github/workflows/ci.yml | 8 ++++++++ Package.resolved | 8 ++++---- Package.swift | 2 +- Tests/GetTests/ClientAuthorizationTests.swift | 3 +++ Tests/GetTests/ClientTests.swift | 2 ++ Tests/GetTests/GitHubAPI.swift | 3 +++ 6 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0489eef..82f7109 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,3 +18,11 @@ jobs: - uses: actions/checkout@v2 - name: Run Tests run: swift test + + linux-run-tests: + name: Unit Tests (Linux) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run Tests + run: swift test diff --git a/Package.resolved b/Package.resolved index 6763371..57702ae 100644 --- a/Package.resolved +++ b/Package.resolved @@ -3,11 +3,11 @@ "pins": [ { "package": "Mocker", - "repositoryURL": "https://github.com/WeTransfer/Mocker.git", + "repositoryURL": "https://github.com/vox-humana/Mocker.git", "state": { - "branch": null, - "revision": "352066f1a29108548386487ae083b4115e94c1fb", - "version": "2.5.4" + "branch": "master", + "revision": "9b2a6f7de644aeb73ae2114f102d5466874df0fa", + "version": null } } ] diff --git a/Package.swift b/Package.swift index 1d9a0b9..bb20623 100644 --- a/Package.swift +++ b/Package.swift @@ -10,7 +10,7 @@ let package = Package( .library(name: "Get", targets: ["Get"]), ], dependencies: [ - .package(url: "https://github.com/WeTransfer/Mocker.git", from: "2.3.0") + .package(url: "https://github.com/vox-humana/Mocker.git", branch: "master") ], targets: [ .target(name: "Get"), diff --git a/Tests/GetTests/ClientAuthorizationTests.swift b/Tests/GetTests/ClientAuthorizationTests.swift index 365d9dd..df22056 100644 --- a/Tests/GetTests/ClientAuthorizationTests.swift +++ b/Tests/GetTests/ClientAuthorizationTests.swift @@ -4,6 +4,9 @@ import XCTest import Mocker +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif @testable import Get final class APIClientAuthorizationTests: XCTestCase { diff --git a/Tests/GetTests/ClientTests.swift b/Tests/GetTests/ClientTests.swift index d47fbf8..94696ac 100644 --- a/Tests/GetTests/ClientTests.swift +++ b/Tests/GetTests/ClientTests.swift @@ -42,9 +42,11 @@ final class APIClientTests: XCTestCase { XCTAssertEqual(response.data.count, 1321) XCTAssertEqual(response.request.url, url) XCTAssertEqual(response.statusCode, 200) +#if !os(Linux) let metrics = try XCTUnwrap(response.metrics) let transaction = try XCTUnwrap(metrics.transactionMetrics.first) XCTAssertEqual(transaction.request.url, URL(string: "https://api.github.com/user")!) +#endif } func testCancellingRequests() async throws { diff --git a/Tests/GetTests/GitHubAPI.swift b/Tests/GetTests/GitHubAPI.swift index f01436f..c59ffe8 100644 --- a/Tests/GetTests/GitHubAPI.swift +++ b/Tests/GetTests/GitHubAPI.swift @@ -3,6 +3,9 @@ // Copyright (c) 2021-2022 Alexander Grebenyuk (github.com/kean). import Foundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif import Get // An example of an API definition. Feel free to use any other method for From 3dedb3ad4d80cdc80338409e8e61b579f6d55de4 Mon Sep 17 00:00:00 2001 From: Arthur Semenyutin Date: Fri, 20 May 2022 11:53:41 +1000 Subject: [PATCH 2/2] Switch to Mocker main repo --- Package.resolved | 8 ++++---- Package.swift | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Package.resolved b/Package.resolved index 57702ae..c88b035 100644 --- a/Package.resolved +++ b/Package.resolved @@ -3,11 +3,11 @@ "pins": [ { "package": "Mocker", - "repositoryURL": "https://github.com/vox-humana/Mocker.git", + "repositoryURL": "https://github.com/WeTransfer/Mocker.git", "state": { - "branch": "master", - "revision": "9b2a6f7de644aeb73ae2114f102d5466874df0fa", - "version": null + "branch": null, + "revision": "5b270d79f39f6628f4c87752f7470ba640e09cba", + "version": "2.5.6" } } ] diff --git a/Package.swift b/Package.swift index bb20623..a49f15e 100644 --- a/Package.swift +++ b/Package.swift @@ -10,7 +10,7 @@ let package = Package( .library(name: "Get", targets: ["Get"]), ], dependencies: [ - .package(url: "https://github.com/vox-humana/Mocker.git", branch: "master") + .package(url: "https://github.com/WeTransfer/Mocker.git", from: "2.5.6") ], targets: [ .target(name: "Get"),