[Enhancement] Communications library for non Apple platforms (#15)

This PR contains the work done to allow the `MakeURLRequestUseCase` use case to be used in non-Apple platforms, as it use has been restricted before.

To provide further details about the work done:
- [x] improved the `MakeURLRequestUseCase` use case to be available in non-Apple platforms;
- [x] moved the `TestEndpoint` helper endpoint to its own file;
- [x] moved some test cases files around;
- [x] updated some text in the `README` file.

Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Reviewed-on: #15
This commit was merged in pull request #15.
This commit is contained in:
2023-04-30 12:33:41 +00:00
parent 94a49afb66
commit fb439a82a8
6 changed files with 53 additions and 37 deletions
@@ -10,11 +10,14 @@
//
//===----------------------------------------------------------------------===//
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
import Communications
import Foundation
import XCTest
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
final class MakeURLRequestUseCaseTests: XCTestCase {
// MARK: Properties
@@ -111,35 +114,3 @@ final class MakeURLRequestUseCaseTests: XCTestCase {
}
}
// MARK: - TestEndpoint
private struct TestEndpoint: Endpoint {
// MARK: Properties
let scheme: String = "http"
let host: String = "www.something.com"
let port: Int?
let path: String = "/path/to/endpoint"
let parameters: Parameters
let method: HTTPRequestMethod = .get
let headers: Headers
let body: Data?
// MARK: Initialisers
init(
port: Int? = nil,
parameters: Parameters = [:],
headers: Headers = [:],
body: Data? = nil
) {
self.port = port
self.parameters = parameters
self.headers = headers
self.body = body
}
}
#endif