diff --git a/Example/PokemonAPI-App.xcodeproj/xcshareddata/xcschemes/PokemonAPI-App (watch).xcscheme b/Example/PokemonAPI-App.xcodeproj/xcshareddata/xcschemes/PokemonAPI-App (watch).xcscheme index 0de013e..7228fad 100644 --- a/Example/PokemonAPI-App.xcodeproj/xcshareddata/xcschemes/PokemonAPI-App (watch).xcscheme +++ b/Example/PokemonAPI-App.xcodeproj/xcshareddata/xcschemes/PokemonAPI-App (watch).xcscheme @@ -54,10 +54,8 @@ debugDocumentVersioning = "YES" debugServiceExtension = "internal" allowLocationSimulation = "YES"> - + - + - + - - - - - + diff --git a/PokemonAPI.xcodeproj/project.pbxproj b/PokemonAPI.xcodeproj/project.pbxproj index 94441de..aa823cb 100644 --- a/PokemonAPI.xcodeproj/project.pbxproj +++ b/PokemonAPI.xcodeproj/project.pbxproj @@ -1281,10 +1281,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/iOS", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "$(SRCROOT)/Resources/iOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 11.0; @@ -1309,10 +1306,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/iOS", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "$(SRCROOT)/Resources/iOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 11.0; @@ -1359,10 +1353,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/watchOS", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "$(SRCROOT)/Resources/watchOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1385,10 +1376,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/watchOS", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "$(SRCROOT)/Resources/watchOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1410,10 +1398,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/tvOS", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "$(SRCROOT)/Resources/tvOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1435,10 +1420,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/tvOS", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "$(SRCROOT)/Resources/tvOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1489,10 +1471,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/Mac", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; FRAMEWORK_VERSION = A; INFOPLIST_FILE = "$(SRCROOT)/Resources/macOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; @@ -1516,10 +1495,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/Mac", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; FRAMEWORK_VERSION = A; INFOPLIST_FILE = "$(SRCROOT)/Resources/macOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; diff --git a/PokemonAPI.xcodeproj/xcshareddata/xcschemes/PokemonAPI macOS.xcscheme b/PokemonAPI.xcodeproj/xcshareddata/xcschemes/PokemonAPI macOS.xcscheme index 5c74413..e52579a 100644 --- a/PokemonAPI.xcodeproj/xcshareddata/xcschemes/PokemonAPI macOS.xcscheme +++ b/PokemonAPI.xcodeproj/xcshareddata/xcschemes/PokemonAPI macOS.xcscheme @@ -42,7 +42,7 @@ diff --git a/PokemonAPI/WebServices/GameService.swift b/PokemonAPI/WebServices/GameService.swift index f5e9567..7575032 100644 --- a/PokemonAPI/WebServices/GameService.swift +++ b/PokemonAPI/WebServices/GameService.swift @@ -440,7 +440,7 @@ extension GameService { */ @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) public func fetchPokedex(_ pokedexID: Int) async throws -> PKMPokedex { - try await PKMPokedex.decode(from: call(endpoint: API.fetchGenerationByID(pokedexID))) + try await PKMPokedex.decode(from: call(endpoint: API.fetchPokedexByID(pokedexID))) } @@ -451,7 +451,7 @@ extension GameService { */ @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) public func fetchPokedex(_ pokedexName: String) async throws -> PKMPokedex { - try await PKMPokedex.decode(from: call(endpoint: API.fetchGenerationByName(pokedexName))) + try await PKMPokedex.decode(from: call(endpoint: API.fetchPokedexByName(pokedexName))) } diff --git a/Tests/PokemonAPITests/Network Mocking/MockedResponse.swift b/Tests/PokemonAPITests/Network Mocking/MockedResponse.swift index 21b6260..566b4de 100644 --- a/Tests/PokemonAPITests/Network Mocking/MockedResponse.swift +++ b/Tests/PokemonAPITests/Network Mocking/MockedResponse.swift @@ -59,27 +59,6 @@ extension RequestMocking.MockedResponse { self.loadingTime = loadingTime customResponse = nil } - - -// init(apiCall: APICall, baseURL: String, customResponse: URLResponse) throws { -// guard let url = try apiCall.createUrlRequest(baseURL: baseURL).url else { throw Error.failedMockCreation } -// self.url = url -// result = .success(Data()) -// httpCode = 200 -// headers = [String: String]() -// loadingTime = 0 -// self.customResponse = customResponse -// } -// -// -// init(url: URL, result: Result) { -// self.url = url -// self.result = result -// httpCode = 200 -// headers = [String: String]() -// loadingTime = 0 -// customResponse = nil -// } } diff --git a/Tests/PokemonAPITests/PokemonAPI_IntegrationTests.swift b/Tests/PokemonAPITests/PokemonAPI_IntegrationTests.swift index b584d00..f5025b4 100644 --- a/Tests/PokemonAPITests/PokemonAPI_IntegrationTests.swift +++ b/Tests/PokemonAPITests/PokemonAPI_IntegrationTests.swift @@ -55,7 +55,7 @@ class PokemonAPITests: XCTestCase { } - @available(iOS 15.0, *) + @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) func testFetchBerryInfo() async throws { let asyncExpectation = expectation(description: "Fetch berry") let _ = try await PokemonAPI().berryService.fetchBerry(1) diff --git a/Tests/PokemonAPITests/ServiceTests/ContestServiceTests.swift b/Tests/PokemonAPITests/ServiceTests/ContestServiceTests.swift index 8500a1f..2464da2 100644 --- a/Tests/PokemonAPITests/ServiceTests/ContestServiceTests.swift +++ b/Tests/PokemonAPITests/ServiceTests/ContestServiceTests.swift @@ -45,6 +45,15 @@ class ContestServiceTests: XCTestCase { // MARK: - Tests + func testFetchContestTypeList_createUrl_success() async throws { + let paginationState: PaginationState = .initial(pageLimit: 5) + let url = try XCTUnwrap(API.fetchContestTypeList.createUrl(baseURL: service.baseURL, paginationState: paginationState), "The url should be created") + + let targetUrl = URL(string: "https://pokeapi.co/api/v2/contest-type?limit=5&offset=0")! + XCTAssertTrue(targetUrl.compareComponents(url)) + } + + func testFetchContestTypeList_success() async throws { let paginationState: PaginationState = .initial(pageLimit: 5) try mock(.fetchContestTypeList, paginationState: paginationState, result: .success(MockContestData.contestTypeList))