diff --git a/Apps/Locations/Libraries/Sources/Locations/Endpoints/GetLocationsEndpoint.swift b/Apps/Locations/Libraries/Sources/Locations/Endpoints/GetLocationsEndpoint.swift new file mode 100644 index 0000000..1755734 --- /dev/null +++ b/Apps/Locations/Libraries/Sources/Locations/Endpoints/GetLocationsEndpoint.swift @@ -0,0 +1,20 @@ +// +// GetLocationsEndpoint.swift +// Locations +// +// Created by Javier Cicchelli on 10/04/2023. +// Copyright © 2023 Röck+Cöde. All rights reserved. +// + +import APICore +import Foundation + +struct GetLocationsEndpoint: Endpoint { + let scheme: String = .Scheme.https + let host: String = .Hosts.default + let port: Int? = nil + let path: String = .Paths.getLocations + let method: HTTPRequestMethod = .get + let headers: [String: String] = [:] + let body: Data? = nil +} diff --git a/Apps/Locations/Libraries/Sources/Locations/Extensions/String+Constants.swift b/Apps/Locations/Libraries/Sources/Locations/Extensions/String+Constants.swift new file mode 100644 index 0000000..3eff3f9 --- /dev/null +++ b/Apps/Locations/Libraries/Sources/Locations/Extensions/String+Constants.swift @@ -0,0 +1,21 @@ +// +// String+Constants.swift +// Locations +// +// Created by Javier Cicchelli on 10/04/2023. +// Copyright © 2023 Röck+Cöde. All rights reserved. +// + +extension String { + enum Scheme { + static let https = "https" + } + + enum Hosts { + static let `default` = "raw.githubusercontent.com" + } + + enum Paths { + static let getLocations = "/abnamrocoesd/assignment-ios/main/locations.json" + } +} diff --git a/Apps/Locations/Libraries/Sources/Locations/Libraries.swift b/Apps/Locations/Libraries/Sources/Locations/Libraries.swift deleted file mode 100644 index c1536b6..0000000 --- a/Apps/Locations/Libraries/Sources/Locations/Libraries.swift +++ /dev/null @@ -1,6 +0,0 @@ -public struct Libraries { - public private(set) var text = "Hello, World!" - - public init() { - } -} diff --git a/Apps/Locations/Libraries/Tests/LocationsTests/Endpoints/GetLocationsEndpointTests.swift b/Apps/Locations/Libraries/Tests/LocationsTests/Endpoints/GetLocationsEndpointTests.swift new file mode 100644 index 0000000..8e12ebb --- /dev/null +++ b/Apps/Locations/Libraries/Tests/LocationsTests/Endpoints/GetLocationsEndpointTests.swift @@ -0,0 +1,36 @@ +// +// 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: Properties + + private var endpoint: GetLocationsEndpoint! + + // MARK: Tests + + func test_init() { + // GIVEN + // WHEN + 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) + } + +} diff --git a/Apps/Locations/Libraries/Tests/LocationsTests/LibrariesTests.swift b/Apps/Locations/Libraries/Tests/LocationsTests/LibrariesTests.swift deleted file mode 100644 index dd47066..0000000 --- a/Apps/Locations/Libraries/Tests/LocationsTests/LibrariesTests.swift +++ /dev/null @@ -1,11 +0,0 @@ -import XCTest -@testable import Libraries - -final class LibrariesTests: XCTestCase { - func testExample() throws { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct - // results. - XCTAssertEqual(Libraries().text, "Hello, World!") - } -}