Adopted Swift 6.2 tools version at the Package in the library target to drop legacy conditional code.
This commit is contained in:
@@ -31,7 +31,6 @@ struct AmiiboServiceLiveTests {
|
||||
|
||||
// MARK: Functions tests
|
||||
|
||||
#if swift(>=6.2)
|
||||
@Test(arguments: zip(
|
||||
Input.amiibos,
|
||||
Output.amiibos
|
||||
@@ -180,156 +179,6 @@ struct AmiiboServiceLiveTests {
|
||||
year: 2026
|
||||
)
|
||||
}
|
||||
#else
|
||||
@Test("get amiibos", arguments: zip(
|
||||
Input.amiibos,
|
||||
Output.amiibos
|
||||
))
|
||||
func getAmiibos(
|
||||
filter: AmiiboFilter,
|
||||
expects numberOfItems: Int
|
||||
) async throws {
|
||||
try await assertAmiibos(
|
||||
with: filter,
|
||||
expects: numberOfItems
|
||||
)
|
||||
}
|
||||
|
||||
@Test("get amiibos throws", arguments: zip(
|
||||
Input.amiibosThrows,
|
||||
Output.amiibosThrows
|
||||
))
|
||||
func getAmiibosThrows(
|
||||
filter: AmiiboFilter,
|
||||
expects error: AmiiboServiceError
|
||||
) async throws {
|
||||
try await assertsAmiibosThrows(
|
||||
error: error,
|
||||
when: filter
|
||||
)
|
||||
}
|
||||
|
||||
@Test("get amiibo series", arguments: zip(
|
||||
Input.amiiboSeries,
|
||||
Output.amiiboSeries
|
||||
))
|
||||
func getAmiiboSeries(
|
||||
filter: AmiiboSeriesFilter,
|
||||
expects numberOfItems: Int
|
||||
) async throws {
|
||||
try await assertAmiiboSeries(
|
||||
with: filter,
|
||||
expects: numberOfItems
|
||||
)
|
||||
}
|
||||
|
||||
@Test("get amiibo series throws", arguments: zip(
|
||||
Input.amiiboSeriesThrows,
|
||||
Output.amiiboSeriesThrows
|
||||
))
|
||||
func getAmiiboSeriesThrows(
|
||||
filter: AmiiboSeriesFilter,
|
||||
expects error: AmiiboServiceError
|
||||
) async throws {
|
||||
try await assertsAmiiboSeriesThrows(
|
||||
error: error,
|
||||
when: filter
|
||||
)
|
||||
}
|
||||
|
||||
@Test("get amiibo types", arguments: zip(
|
||||
Input.amiiboTypes,
|
||||
Output.amiiboTypes
|
||||
))
|
||||
func getAmiiboTypes(
|
||||
filter: AmiiboTypeFilter,
|
||||
expects numberOfItems: Int
|
||||
) async throws {
|
||||
try await assertAmiiboTypes(
|
||||
with: filter,
|
||||
expects: numberOfItems
|
||||
)
|
||||
}
|
||||
|
||||
@Test("get amiibo types throws", arguments: zip(
|
||||
Input.amiiboTypesThrows,
|
||||
Output.amiiboTypesThrows
|
||||
))
|
||||
func getAmiiboTypesThrows(
|
||||
filter: AmiiboTypeFilter,
|
||||
expects error: AmiiboServiceError
|
||||
) async throws {
|
||||
try await assertsAmiiboTypesThrows(
|
||||
error: error,
|
||||
when: filter
|
||||
)
|
||||
}
|
||||
|
||||
@Test("get game characters", arguments: zip(
|
||||
Input.gameCharacters,
|
||||
Output.gameCharacters
|
||||
))
|
||||
func getGameCharacters(
|
||||
filter: GameCharacterFilter,
|
||||
expects numberOfItems: Int
|
||||
) async throws {
|
||||
try await assertGameCharacters(
|
||||
with: filter,
|
||||
expects: numberOfItems
|
||||
)
|
||||
}
|
||||
|
||||
@Test("get game characters throws", arguments: zip(
|
||||
Input.gameCharactersThrows,
|
||||
Output.gameCharactersThrows
|
||||
))
|
||||
func getGameCharactersThrows(
|
||||
filter: GameCharacterFilter,
|
||||
expects error: AmiiboServiceError
|
||||
) async throws {
|
||||
try await assertsGameCharactersThrows(
|
||||
error: error,
|
||||
when: filter
|
||||
)
|
||||
}
|
||||
|
||||
@Test("get game series", arguments: zip(
|
||||
Input.gameSeries,
|
||||
Output.gameSeries
|
||||
))
|
||||
func getGameSeries(
|
||||
filter: GameSeriesFilter,
|
||||
expects numberOfItems: Int
|
||||
) async throws {
|
||||
try await assertGameSeries(
|
||||
with: filter,
|
||||
expects: numberOfItems
|
||||
)
|
||||
}
|
||||
|
||||
@Test("get game series throws", arguments: zip(
|
||||
Input.gameSeriesThrows,
|
||||
Output.gameSeriesThrows
|
||||
))
|
||||
func getGameSeriesThrows(
|
||||
filter: GameSeriesFilter,
|
||||
expects error: AmiiboServiceError
|
||||
) async throws {
|
||||
try await assertsGameSeriesThrows(
|
||||
error: error,
|
||||
when: filter
|
||||
)
|
||||
}
|
||||
|
||||
@Test("get last updated timestamp")
|
||||
func getLastUpdated() async throws {
|
||||
try await assertLastUpdated(
|
||||
day: 24,
|
||||
month: 7,
|
||||
year: 2026
|
||||
)
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,6 @@ extension AmiiboMockClient: AmiiboClient {
|
||||
|
||||
// MARK: Functions
|
||||
|
||||
#if swift(>=6.0)
|
||||
func getAmiibos(
|
||||
by filter: AmiiboFilter
|
||||
) async throws(AmiiboServiceError) -> [Amiibo] {
|
||||
@@ -110,43 +109,8 @@ extension AmiiboMockClient: AmiiboClient {
|
||||
}
|
||||
|
||||
func getLastUpdated() async throws(AmiiboServiceError) -> Date {
|
||||
fetchLastUpdatedIfAny()
|
||||
}
|
||||
#else
|
||||
func getAmiibos(
|
||||
by filter: AmiiboFilter
|
||||
) async throws -> [Amiibo] {
|
||||
try fetchAmiibosIfAny()
|
||||
}
|
||||
|
||||
func getAmiiboSeries(
|
||||
by filter: AmiiboSeriesFilter
|
||||
) async throws -> [AmiiboSeries] {
|
||||
try fetchAmiiboSeriesIfAny()
|
||||
}
|
||||
|
||||
func getAmiiboTypes(
|
||||
by filter: AmiiboTypeFilter
|
||||
) async throws -> [AmiiboType] {
|
||||
try fetchAmiiboTypesIfAny()
|
||||
}
|
||||
|
||||
func getGameCharacters(
|
||||
by filter: GameCharacterFilter
|
||||
) async throws -> [GameCharacter] {
|
||||
try fetchGameCharactersIfAny()
|
||||
}
|
||||
|
||||
func getGameSeries(
|
||||
by filter: GameSeriesFilter
|
||||
) async throws -> [GameSeries] {
|
||||
try fetchGameSeriesIfAny()
|
||||
}
|
||||
|
||||
func getLastUpdated() async throws -> Date {
|
||||
try fetchLastUpdatedIfAny()
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -159,7 +123,7 @@ private extension AmiiboMockClient {
|
||||
/// Fetches a list of amiibo items, if any.
|
||||
/// - Returns: A list of amiibo items.
|
||||
/// - Throws: An ``AmiiboServiceError`` error in case an error has been provided.
|
||||
func fetchAmiibosIfAny() throws -> [Amiibo] {
|
||||
func fetchAmiibosIfAny() throws(AmiiboServiceError) -> [Amiibo] {
|
||||
try throwErrorIfExists()
|
||||
|
||||
guard let amiibos else {
|
||||
@@ -172,7 +136,7 @@ private extension AmiiboMockClient {
|
||||
/// Fetches a list of amiibo series, if any.
|
||||
/// - Returns: A list of amiibo series.
|
||||
/// - Throws: An ``AmiiboServiceError`` error in case an error has been provided.
|
||||
func fetchAmiiboSeriesIfAny() throws -> [AmiiboSeries] {
|
||||
func fetchAmiiboSeriesIfAny() throws(AmiiboServiceError) -> [AmiiboSeries] {
|
||||
try throwErrorIfExists()
|
||||
|
||||
guard let amiiboSeries else {
|
||||
@@ -185,7 +149,7 @@ private extension AmiiboMockClient {
|
||||
/// Fetches a list of amiibo types, if any.
|
||||
/// - Returns: A list of amiibo types.
|
||||
/// - Throws: An ``AmiiboServiceError`` error in case an error has been provided.
|
||||
func fetchAmiiboTypesIfAny() throws -> [AmiiboType] {
|
||||
func fetchAmiiboTypesIfAny() throws(AmiiboServiceError) -> [AmiiboType] {
|
||||
try throwErrorIfExists()
|
||||
|
||||
guard let amiiboTypes else {
|
||||
@@ -198,7 +162,7 @@ private extension AmiiboMockClient {
|
||||
/// Fetches a list of game characters, if any.
|
||||
/// - Returns: A list of game characters.
|
||||
/// - Throws: An ``AmiiboServiceError`` error in case an error has been provided.
|
||||
func fetchGameCharactersIfAny() throws -> [GameCharacter] {
|
||||
func fetchGameCharactersIfAny() throws(AmiiboServiceError) -> [GameCharacter] {
|
||||
try throwErrorIfExists()
|
||||
|
||||
guard let gameCharacters else {
|
||||
@@ -211,7 +175,7 @@ private extension AmiiboMockClient {
|
||||
/// Fetches a list of game series, if any.
|
||||
/// - Returns: A list of game series, if any.
|
||||
/// - Throws: An ``AmiiboServiceError`` error in case an error has been provided.
|
||||
func fetchGameSeriesIfAny() throws -> [GameSeries] {
|
||||
func fetchGameSeriesIfAny() throws(AmiiboServiceError) -> [GameSeries] {
|
||||
try throwErrorIfExists()
|
||||
|
||||
guard let gameSeries else {
|
||||
@@ -224,7 +188,7 @@ private extension AmiiboMockClient {
|
||||
/// Fetches a last updated date, if any.
|
||||
/// - Returns: A last updated date.
|
||||
/// - Throws: An ``AmiiboServiceError`` error in case an error has been provided.
|
||||
func fetchLastUpdatedIfAny() throws -> Date {
|
||||
func fetchLastUpdatedIfAny() throws(AmiiboServiceError) -> Date {
|
||||
try throwErrorIfExists()
|
||||
|
||||
guard let lastUpdated else {
|
||||
|
||||
Reference in New Issue
Block a user