Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running tests on Linux #32

Merged
merged 2 commits into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/WeTransfer/Mocker.git",
"state": {
"branch": null,
"revision": "352066f1a29108548386487ae083b4115e94c1fb",
"version": "2.5.4"
"revision": "5b270d79f39f6628f4c87752f7470ba640e09cba",
"version": "2.5.6"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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/WeTransfer/Mocker.git", from: "2.5.6")
],
targets: [
.target(name: "Get"),
Expand Down
3 changes: 3 additions & 0 deletions Tests/GetTests/ClientAuthorizationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

import XCTest
import Mocker
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
@testable import Get

final class APIClientAuthorizationTests: XCTestCase {
Expand Down
2 changes: 2 additions & 0 deletions Tests/GetTests/ClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions Tests/GetTests/GitHubAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down