This PR contains the work that implements the Locations service, which is used to retrieve location data from a remote server. To give further details on what was done: - [x] created the `APICore` and `Locations` libraries into the **Libraries** package; - [x] defined the `Endpoint` and `Client` protocols; - [x] implemented the `MakeURLRequestUseCase` use case; - [x] implemented the `MockURLProtocol` protocol and the `MockURLResponse` models; - [x] implemented the `Location` model; - [x] implemented the `GetLocationsEndpoint` endpoint; - [x] implemented the `LocationsClient` client; - [x] implemented the `LocationsService` service. Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Reviewed-on: rock-n-code/deep-linking-assignment#4
33 lines
746 B
Swift
33 lines
746 B
Swift
//
|
|
// GetLocationsEndpointTests.swift
|
|
// LocationsTests
|
|
//
|
|
// Created by Javier Cicchelli on 10/04/2023.
|
|
// Copyright © 2023 Röck+Cöde. All rights reserved.
|
|
//
|
|
|
|
import XCTest
|
|
|
|
@testable import Locations
|
|
|
|
final class GetLocationsEndpointTests: XCTestCase {
|
|
|
|
// MARK: Tests
|
|
|
|
func test_init() {
|
|
// GIVEN
|
|
// WHEN
|
|
let endpoint = GetLocationsEndpoint()
|
|
|
|
// THEN
|
|
XCTAssertNotNil(endpoint)
|
|
XCTAssertEqual(endpoint.scheme, .Scheme.https)
|
|
XCTAssertEqual(endpoint.host, .Hosts.default)
|
|
XCTAssertNil(endpoint.port)
|
|
XCTAssertEqual(endpoint.path, .Paths.getLocations)
|
|
XCTAssertTrue(endpoint.headers.isEmpty)
|
|
XCTAssertNil(endpoint.body)
|
|
}
|
|
|
|
}
|