Some fixes to the live test suite (#32)
CI / Build and test (push) Canceled after 0s
Documentation / Build documentation (push) Canceled after 0s
Documentation / Deploy to GitHub Pages (push) Canceled after 0s

This PR contains the work done to fix the live test suite, which started failing once the Amiibo API began returning Switch 2 games, and tidies the test suite around it.

### Changes

- **Live tests:** replaced the assertion that the first amiibo has no Switch 2 games with a usage check, matching the other platforms. The live data now includes Switch 2 entries for most amiibos.
- **Live tests:** refreshed the minimum item counts and the earliest accepted last-updated date to the values observed in October 2026, and documented in the README how to refresh them.
- **All tests:** moved test descriptions from `@Test("...")` strings into backticked function names, and aligned every case on the same GIVEN/WHEN/THEN structure.
- **Live client:** replaced the TODO about DocC inherited docs with a note. The compiler does not inherit documentation for protocol witnesses, so the repeated doc comments stay on purpose.

Reviewed-on: #32
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #32.
This commit is contained in:
javier authored and Javier Cicchelli committed 2026-10-25 21:53:31 +00:00
1 parent 13b9c74a38
commit 4cbac015b1
8 files changed
+134 -130

No files matched your search

+10
View File
@@ -133,6 +133,16 @@ AMIIBO_LIVE_TESTS=1 swift test
In Xcode, set the variable in the scheme's **Test** action.
The live tests compare the responses against baselines recorded from the service: minimum item counts per endpoint and the earliest accepted last-updated date. These live in the `Int` extension at the bottom of `AmiiboServiceLiveTests.swift` and in the `get the last updated timestamp` test. Refresh them occasionally by fetching the current totals and the current timestamp from the service, then updating the constants and their `as of` notes:
```shell
for endpoint in amiibo amiiboseries type character gameseries; do
printf '%s: ' "$endpoint"
curl -s "https://www.amiiboapi.org/api/$endpoint/" | python3 -c 'import json,sys; print(len(json.load(sys.stdin)["amiibo"]))'
done
curl -s https://www.amiiboapi.org/api/lastupdated/
```
## Documentation
See the [online documentation](https://rock-n-code.github.io/amiibo-service/documentation/amiiboservice/).
@@ -54,7 +54,8 @@ public struct AmiiboLiveClient: Sendable {
}
// MARK: - AmiiboClient
// TODO: Remove the documentation from the functions inside the following extension as the `--enable-inherited-docs` flag when generating DocC documentation is not working as intended (?).
// NOTE: The `AmiiboClient` documentation is repeated below on purpose, as the compiler does not inherit
// documentation for protocol witnesses and DocC would otherwise render these functions undocumented.
extension AmiiboLiveClient: AmiiboClient {
@@ -25,8 +25,8 @@ struct ISODateTimeTranscoderTests {
// MARK: Decode tests
@Test("decodes a timestamp as UTC")
func decodesTimestamp() throws {
@Test
func `decodes a timestamp as UTC`() throws {
// GIVEN
let string = "2026-07-24T12:34:56.123000"
@@ -37,8 +37,8 @@ struct ISODateTimeTranscoderTests {
#expect(abs(date.timeIntervalSince(.utc(2026, 7, 24, 12, 34, 56)) - 0.123) < 0.001)
}
@Test("decodes a date-only string as midnight UTC")
func decodesDate() throws {
@Test
func `decodes a date-only string as midnight UTC`() throws {
// GIVEN
let string = "2014-11-21"
@@ -49,10 +49,10 @@ struct ISODateTimeTranscoderTests {
#expect(date == .utc(2014, 11, 21))
}
@Test("throws a decoding error for an unsupported string", arguments: [
@Test(arguments: [
"", "2014-11", "2014-11-21T12:34:56", "2014-11-21T12:34:56Z", "21/11/2014", "yesterday"
])
func throwsForUnsupportedString(string: String) {
func `throws a decoding error for an unsupported string`(string: String) {
// GIVEN
// WHEN
// THEN
@@ -63,8 +63,8 @@ struct ISODateTimeTranscoderTests {
// MARK: Encode tests
@Test("encodes a date as a timestamp")
func encodesTimestamp() throws {
@Test
func `encodes a date as a timestamp`() throws {
// GIVEN
let date: Date = .utc(2026, 7, 24, 12, 34, 56)
@@ -22,8 +22,8 @@ struct AmiiboLiveClientTests {
// MARK: Server URL tests
@Test("resolves the server URL defined in the OpenAPI specification")
func serverURLResolves() throws {
@Test
func `resolves the server URL defined in the OpenAPI specification`() throws {
// GIVEN
// WHEN
let url = try Servers.Server1.url()
@@ -32,8 +32,8 @@ struct AmiiboLiveClientTests {
#expect(url.absoluteString == "https://www.amiiboapi.org/api")
}
@Test("uses the server URL from the OpenAPI specification")
func serverURLMatchesSpecification() throws {
@Test
func `uses the server URL from the OpenAPI specification`() throws {
// GIVEN
let expected = try Servers.Server1.url()
@@ -46,14 +46,11 @@ struct AmiiboLiveClientTests {
// MARK: Error mapping tests
@Test(
"maps an error thrown by the transport to the matching service error",
arguments: zip(
@Test(arguments: zip(
TransportErrors.thrown,
TransportErrors.expected
)
)
func mapsTransportError(
))
func `maps an error thrown by the transport to the matching service error`(
thrown: any Error,
expected: AmiiboServiceError
) async {
@@ -67,14 +64,11 @@ struct AmiiboLiveClientTests {
}
}
@Test(
"maps a response status to the matching service error",
arguments: zip(
@Test(arguments: zip(
Responses.failing,
Responses.expected
)
)
func mapsResponseStatus(
))
func `maps a response status to the matching service error`(
response: (status: Int, json: String?),
expected: AmiiboServiceError
) async {
@@ -93,8 +87,8 @@ struct AmiiboLiveClientTests {
// MARK: Get Amiibos tests
@Test("returns amiibos sorted by identifier")
func getAmiibosSorted() async throws {
@Test
func `returns amiibos sorted by identifier`() async throws {
// GIVEN
let client = AmiiboLiveClient(transport: StubTransport(status: .ok, json: JSON.amiibos))
@@ -106,8 +100,8 @@ struct AmiiboLiveClientTests {
#expect(amiibos.map(\.name) == ["Mario", "Zelda"])
}
@Test("returns a single amiibo when the response holds an object")
func getAmiibosSingle() async throws {
@Test
func `returns a single amiibo when the response holds an object`() async throws {
// GIVEN
let client = AmiiboLiveClient(transport: StubTransport(status: .ok, json: JSON.amiibo))
@@ -128,8 +122,8 @@ struct AmiiboLiveClientTests {
#expect(amiibo.platform == nil)
}
@Test("returns no amiibos when the response holds null")
func getAmiibosNull() async throws {
@Test
func `returns no amiibos when the response holds null`() async throws {
// GIVEN
let client = AmiiboLiveClient(transport: StubTransport(status: .ok, json: JSON.amiibosNull))
@@ -140,8 +134,8 @@ struct AmiiboLiveClientTests {
#expect(amiibos.isEmpty)
}
@Test("returns no amiibos when the response holds an empty list")
func getAmiibosEmpty() async throws {
@Test
func `returns no amiibos when the response holds an empty list`() async throws {
// GIVEN
let client = AmiiboLiveClient(transport: StubTransport(status: .ok, json: JSON.amiibosEmpty))
@@ -152,8 +146,8 @@ struct AmiiboLiveClientTests {
#expect(amiibos.isEmpty)
}
@Test("decodes release dates as midnight UTC, and missing or null ones as nil")
func getAmiibosRelease() async throws {
@Test
func `decodes release dates as midnight UTC, and missing or null ones as nil`() async throws {
// GIVEN
let client = AmiiboLiveClient(transport: StubTransport(status: .ok, json: JSON.amiibos))
@@ -171,8 +165,8 @@ struct AmiiboLiveClientTests {
#expect(zelda.release.japan == nil)
}
@Test("maps related games and usages into the platform")
func getAmiibosPlatform() async throws {
@Test
func `maps related games and usages into the platform`() async throws {
// GIVEN
let client = AmiiboLiveClient(transport: StubTransport(status: .ok, json: JSON.amiiboWithGames))
@@ -192,8 +186,8 @@ struct AmiiboLiveClientTests {
#expect(platform.wiiU.first?.usages == nil)
}
@Test("encodes the amiibo filter as query parameters")
func getAmiibosQuery() async throws {
@Test
func `encodes the amiibo filter as query parameters`() async throws {
// GIVEN
let client = AmiiboLiveClient(transport: StubTransport { request in
let path = request.path ?? ""
@@ -229,8 +223,8 @@ struct AmiiboLiveClientTests {
))
}
@Test("omits nil filter values from the query")
func getAmiibosEmptyQuery() async throws {
@Test
func `omits nil filter values from the query`() async throws {
// GIVEN
let client = AmiiboLiveClient(transport: StubTransport { request in
#expect(request.path == "/amiibo")
@@ -245,8 +239,8 @@ struct AmiiboLiveClientTests {
// MARK: Key-name endpoints tests
@Test("returns amiibo series sorted by key")
func getAmiiboSeriesSorted() async throws {
@Test
func `returns amiibo series sorted by key`() async throws {
// GIVEN
let client = AmiiboLiveClient(transport: StubTransport(status: .ok, json: JSON.keyNameList))
@@ -257,8 +251,8 @@ struct AmiiboLiveClientTests {
#expect(series == [.init(key: "0x00", name: "Second"), .init(key: "0x01", name: "First")])
}
@Test("returns a single amiibo series when the response holds an object")
func getAmiiboSeriesSingle() async throws {
@Test
func `returns a single amiibo series when the response holds an object`() async throws {
// GIVEN
let client = AmiiboLiveClient(transport: StubTransport { request in
#expect(request.path == "/amiiboseries?key=0x01")
@@ -273,8 +267,8 @@ struct AmiiboLiveClientTests {
#expect(series == [.init(key: "0x01", name: "First")])
}
@Test("returns amiibo types sorted by key")
func getAmiiboTypesSorted() async throws {
@Test
func `returns amiibo types sorted by key`() async throws {
// GIVEN
let client = AmiiboLiveClient(transport: StubTransport { request in
#expect(request.path == "/type")
@@ -289,8 +283,8 @@ struct AmiiboLiveClientTests {
#expect(types == [.init(key: "0x00", name: "Second"), .init(key: "0x01", name: "First")])
}
@Test("returns game characters sorted by key")
func getGameCharactersSorted() async throws {
@Test
func `returns game characters sorted by key`() async throws {
// GIVEN
let client = AmiiboLiveClient(transport: StubTransport { request in
#expect(request.path == "/character?name=First")
@@ -305,8 +299,8 @@ struct AmiiboLiveClientTests {
#expect(characters == [.init(key: "0x00", name: "Second"), .init(key: "0x01", name: "First")])
}
@Test("returns game series sorted by key")
func getGameSeriesSorted() async throws {
@Test
func `returns game series sorted by key`() async throws {
// GIVEN
let client = AmiiboLiveClient(transport: StubTransport { request in
#expect(request.path == "/gameseries")
@@ -321,8 +315,8 @@ struct AmiiboLiveClientTests {
#expect(series == [.init(key: "0x00", name: "Second"), .init(key: "0x01", name: "First")])
}
@Test("throws notFound when a key-name endpoint matches nothing")
func getKeyNameNotFound() async {
@Test
func `throws notFound when a key-name endpoint matches nothing`() async {
// GIVEN
let client = AmiiboLiveClient(transport: StubTransport(status: .notFound, json: JSON.notFound))
@@ -335,8 +329,8 @@ struct AmiiboLiveClientTests {
// MARK: Get Last Updated tests
@Test("returns the last updated timestamp as UTC")
func getLastUpdated() async throws {
@Test
func `returns the last updated timestamp as UTC`() async throws {
// GIVEN
let client = AmiiboLiveClient(transport: StubTransport { request in
#expect(request.path == "/lastupdated")
@@ -351,8 +345,8 @@ struct AmiiboLiveClientTests {
#expect(lastUpdated == .utc(2026, 7, 24, 12, 34, 56))
}
@Test("throws notAvailable when the last updated endpoint fails")
func getLastUpdatedNotAvailable() async {
@Test
func `throws notAvailable when the last updated endpoint fails`() async {
// GIVEN
let client = AmiiboLiveClient(transport: StubTransport(status: .internalServerError))
@@ -20,8 +20,8 @@ struct FilterConformanceTests {
// MARK: Equatable tests
@Test("compares amiibo filters by value")
func amiiboFilterEquality() {
@Test
func `compares amiibo filters by value`() {
// GIVEN
// WHEN
// THEN
@@ -31,8 +31,8 @@ struct FilterConformanceTests {
#expect(AmiiboFilter() != AmiiboFilter(showGames: true))
}
@Test("compares key-name filters by value")
func keyNameFilterEquality() {
@Test
func `compares key-name filters by value`() {
// GIVEN
// WHEN
// THEN
@@ -46,8 +46,8 @@ struct FilterConformanceTests {
// MARK: Hashable tests
@Test("hashes equal filters alike")
func filterHashing() {
@Test
func `hashes equal filters alike`() {
// GIVEN
let amiiboFilters: Set = [AmiiboFilter(name: "zelda"), AmiiboFilter(name: "zelda"), AmiiboFilter(name: "mario")]
let seriesFilters: Set = [AmiiboSeriesFilter(key: "0x01"), AmiiboSeriesFilter(key: "0x01"), AmiiboSeriesFilter()]
@@ -21,8 +21,8 @@ struct ModelConformanceTests {
// MARK: Identifiable tests
@Test("identifies an amiibo by its identifier")
func amiiboID() {
@Test
func `identifies an amiibo by its identifier`() {
// GIVEN
let amiibos = Fixtures.amiibos
@@ -31,8 +31,8 @@ struct ModelConformanceTests {
#expect(amiibos.map(\.id) == amiibos.map(\.identifier))
}
@Test("identifies key-name models by their keys")
func keyNameIDs() {
@Test
func `identifies key-name models by their keys`() {
// GIVEN
// WHEN
// THEN
@@ -44,8 +44,8 @@ struct ModelConformanceTests {
// MARK: Codable tests
@Test("round-trips amiibos through JSON")
func amiibosRoundTrip() throws {
@Test
func `round-trips amiibos through JSON`() throws {
// GIVEN
let amiibos = Fixtures.amiibos
@@ -57,8 +57,8 @@ struct ModelConformanceTests {
#expect(decoded.first?.platform?.switch.first?.usages?.isEmpty == false)
}
@Test("round-trips key-name models through JSON")
func keyNameRoundTrip() throws {
@Test
func `round-trips key-name models through JSON`() throws {
// GIVEN
// WHEN
// THEN
@@ -181,8 +181,8 @@ struct AmiiboServiceLiveTests {
@Test
func `get the last updated timestamp`() async throws {
try await assertLastUpdated(
onOrAfterDay: 24,
month: 7,
onOrAfterDay: 22,
month: 10,
year: 2026
)
}
@@ -221,8 +221,7 @@ private extension AmiiboServiceLiveTests {
if filter.showUsage == true {
#expect(firstAmiiboPlatform.switch.first?.usages?.isEmpty == false)
// Given the live data is still not returning any Switch 2 games.
#expect(firstAmiiboPlatform.switch2.isEmpty == true)
#expect(firstAmiiboPlatform.switch2.first?.usages?.isEmpty == false)
#expect(firstAmiiboPlatform.threeDS.first?.usages?.isEmpty == false)
#expect(firstAmiiboPlatform.wiiU.first?.usages?.isEmpty == false)
}
@@ -584,16 +583,16 @@ enum Output {
// MARK: - Constants
private extension Int {
/// A number that represents the minimum number of amiibo items expected from the live service, as of July 2026.
static let minimumAmiibos = 946
/// A number that represents the minimum number of amiibo series expected from the live service, as of July 2026.
static let minimumAmiiboSeries = 31
/// A number that represents the minimum number of amiibo types expected from the live service, as of July 2026.
/// A number that represents the minimum number of amiibo items expected from the live service, as of October 2026.
static let minimumAmiibos = 952
/// A number that represents the minimum number of amiibo series expected from the live service, as of October 2026.
static let minimumAmiiboSeries = 32
/// A number that represents the minimum number of amiibo types expected from the live service, as of October 2026.
static let minimumAmiiboTypes = 5
/// A number that represents the minimum number of game characters expected from the live service, as of July 2026.
static let minimumGameCharacters = 681
/// A number that represents the minimum number of game series expected from the live service, as of July 2026.
static let minimumGameSeries = 118
/// A number that represents the minimum number of game characters expected from the live service, as of October 2026.
static let minimumGameCharacters = 685
/// A number that represents the minimum number of game series expected from the live service, as of October 2026.
static let minimumGameSeries = 119
}
private extension String {
@@ -21,8 +21,8 @@ struct AmiiboServiceMockTests {
// MARK: Get Amiibos tests
@Test("returns empty amiibos when mock provides an empty list")
func getAmiibosEmpty() async throws {
@Test
func `returns empty amiibos when mock provides an empty list`() async throws {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient(amiibos: []))
@@ -33,8 +33,8 @@ struct AmiiboServiceMockTests {
#expect(amiibos.isEmpty)
}
@Test("returns amiibos when mock provides a list")
func getAmiibosList() async throws {
@Test
func `returns amiibos when mock provides a list`() async throws {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient(amiibos: Fixtures.amiibos))
@@ -47,8 +47,8 @@ struct AmiiboServiceMockTests {
#expect(amiibos.first?.imageURL != nil)
}
@Test("throws notFound when mock provides no amiibos")
func getAmiibosNotFound() async {
@Test
func `throws notFound when mock provides no amiibos`() async {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient())
@@ -59,8 +59,8 @@ struct AmiiboServiceMockTests {
}
}
@Test("throws error for amiibos when mock is configured with error", arguments: Errors.all)
func getAmiibosThrows(error: AmiiboServiceError) async {
@Test(arguments: Errors.all)
func `throws error for amiibos when mock is configured with error`(error: AmiiboServiceError) async {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient(error: error))
@@ -73,8 +73,8 @@ struct AmiiboServiceMockTests {
// MARK: Get Amiibo Series tests
@Test("returns empty amiibo series when mock provides an empty list")
func getAmiiboSeriesEmpty() async throws {
@Test
func `returns empty amiibo series when mock provides an empty list`() async throws {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient(amiiboSeries: []))
@@ -85,8 +85,8 @@ struct AmiiboServiceMockTests {
#expect(amiiboSeries.isEmpty)
}
@Test("returns amiibo series when mock provides a list")
func getAmiiboSeriesList() async throws {
@Test
func `returns amiibo series when mock provides a list`() async throws {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient(amiiboSeries: Fixtures.amiiboSeries))
@@ -97,8 +97,8 @@ struct AmiiboServiceMockTests {
#expect(amiiboSeries == Fixtures.amiiboSeries)
}
@Test("throws notFound when mock provides no amiibo series")
func getAmiiboSeriesNotFound() async {
@Test
func `throws notFound when mock provides no amiibo series`() async {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient())
@@ -109,8 +109,8 @@ struct AmiiboServiceMockTests {
}
}
@Test("throws error for amiibo series when mock is configured with error", arguments: Errors.all)
func getAmiiboSeriesThrows(error: AmiiboServiceError) async {
@Test(arguments: Errors.all)
func `throws error for amiibo series when mock is configured with error`(error: AmiiboServiceError) async {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient(error: error))
@@ -123,8 +123,8 @@ struct AmiiboServiceMockTests {
// MARK: Get Amiibo Types tests
@Test("returns empty amiibo types when mock provides an empty list")
func getAmiiboTypesEmpty() async throws {
@Test
func `returns empty amiibo types when mock provides an empty list`() async throws {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient(amiiboTypes: []))
@@ -135,8 +135,8 @@ struct AmiiboServiceMockTests {
#expect(amiiboTypes.isEmpty)
}
@Test("returns amiibo types when mock provides a list")
func getAmiiboTypesList() async throws {
@Test
func `returns amiibo types when mock provides a list`() async throws {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient(amiiboTypes: Fixtures.amiiboTypes))
@@ -147,8 +147,8 @@ struct AmiiboServiceMockTests {
#expect(amiiboTypes == Fixtures.amiiboTypes)
}
@Test("throws notFound when mock provides no amiibo types")
func getAmiiboTypesNotFound() async {
@Test
func `throws notFound when mock provides no amiibo types`() async {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient())
@@ -159,8 +159,8 @@ struct AmiiboServiceMockTests {
}
}
@Test("throws error for amiibo types when mock is configured with error", arguments: Errors.all)
func getAmiiboTypesThrows(error: AmiiboServiceError) async {
@Test(arguments: Errors.all)
func `throws error for amiibo types when mock is configured with error`(error: AmiiboServiceError) async {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient(error: error))
@@ -173,8 +173,8 @@ struct AmiiboServiceMockTests {
// MARK: Get Game Characters tests
@Test("returns empty game characters when mock provides an empty list")
func getGameCharactersEmpty() async throws {
@Test
func `returns empty game characters when mock provides an empty list`() async throws {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient(gameCharacters: []))
@@ -185,8 +185,8 @@ struct AmiiboServiceMockTests {
#expect(gameCharacters.isEmpty)
}
@Test("returns game characters when mock provides a list")
func getGameCharactersList() async throws {
@Test
func `returns game characters when mock provides a list`() async throws {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient(gameCharacters: Fixtures.gameCharacters))
@@ -197,8 +197,8 @@ struct AmiiboServiceMockTests {
#expect(gameCharacters == Fixtures.gameCharacters)
}
@Test("throws notFound when mock provides no game characters")
func getGameCharactersNotFound() async {
@Test
func `throws notFound when mock provides no game characters`() async {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient())
@@ -209,8 +209,8 @@ struct AmiiboServiceMockTests {
}
}
@Test("throws error for game characters when mock is configured with error", arguments: Errors.all)
func getGameCharactersThrows(error: AmiiboServiceError) async {
@Test(arguments: Errors.all)
func `throws error for game characters when mock is configured with error`(error: AmiiboServiceError) async {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient(error: error))
@@ -223,8 +223,8 @@ struct AmiiboServiceMockTests {
// MARK: Get Game Series tests
@Test("returns empty game series when mock provides an empty list")
func getGameSeriesEmpty() async throws {
@Test
func `returns empty game series when mock provides an empty list`() async throws {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient(gameSeries: []))
@@ -235,8 +235,8 @@ struct AmiiboServiceMockTests {
#expect(gameSeries.isEmpty)
}
@Test("returns game series when mock provides a list")
func getGameSeriesList() async throws {
@Test
func `returns game series when mock provides a list`() async throws {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient(gameSeries: Fixtures.gameSeries))
@@ -247,8 +247,8 @@ struct AmiiboServiceMockTests {
#expect(gameSeries == Fixtures.gameSeries)
}
@Test("throws notFound when mock provides no game series")
func getGameSeriesNotFound() async {
@Test
func `throws notFound when mock provides no game series`() async {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient())
@@ -259,8 +259,8 @@ struct AmiiboServiceMockTests {
}
}
@Test("throws error for game series when mock is configured with error", arguments: Errors.all)
func getGameSeriesThrows(error: AmiiboServiceError) async {
@Test(arguments: Errors.all)
func `throws error for game series when mock is configured with error`(error: AmiiboServiceError) async {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient(error: error))
@@ -273,8 +273,8 @@ struct AmiiboServiceMockTests {
// MARK: Get Last Updated tests
@Test("returns date when mock provides a last updated date")
func getLastUpdated() async throws {
@Test
func `returns date when mock provides a last updated date`() async throws {
// GIVEN
let expectedDate = Date(timeIntervalSince1970: 1_700_000_000)
let service = AmiiboService(client: AmiiboMockClient(lastUpdated: expectedDate))
@@ -286,8 +286,8 @@ struct AmiiboServiceMockTests {
#expect(lastUpdated == expectedDate)
}
@Test("throws notFound when mock provides no last updated date")
func getLastUpdatedNotFound() async {
@Test
func `throws notFound when mock provides no last updated date`() async {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient())
@@ -298,8 +298,8 @@ struct AmiiboServiceMockTests {
}
}
@Test("throws error for last updated when mock is configured with error", arguments: Errors.all)
func getLastUpdatedThrows(error: AmiiboServiceError) async {
@Test(arguments: Errors.all)
func `throws error for last updated when mock is configured with error`(error: AmiiboServiceError) async {
// GIVEN
let service = AmiiboService(client: AmiiboMockClient(error: error))