I think we're done

This commit is contained in:
cdricms
2026-03-21 18:25:21 +01:00
parent 2d1e8e1044
commit ba9e2db1b9
26 changed files with 281 additions and 63 deletions

View File

@@ -157,5 +157,43 @@ import Testing
""".data(using: .utf8)!
let artist = try JSONDecoder().decode(Artist.self, from: json)
#expect(artist.imageURL?.absoluteString == "https://commons.wikimedia.org/wiki/File:Michael_Jackson_1984.jpg")
#expect(artist.imageURL?.absoluteString == "https://commons.wikimedia.org/wiki/Special:FilePath/Michael_Jackson_1984.jpg")
}
@Test func testRecordingYouTubeURL() throws {
let json = """
{
"id": "abc",
"title": "Billie Jean",
"relations": [
{
"type": "video",
"direction": "forward",
"url": {
"id": "456",
"resource": "https://www.youtube.com/watch?v=Zi_XLOBDo_Y"
}
}
]
}
""".data(using: .utf8)!
let recording = try JSONDecoder().decode(Recording.self, from: json)
#expect(recording.youtubeURL?.absoluteString == "https://www.youtube.com/watch?v=Zi_XLOBDo_Y")
}
@Test func testReleaseFormatDecoding() throws {
let json = """
[
"CD",
"Digital Media",
"Unknown Format XY"
]
""".data(using: .utf8)!
let formats = try JSONDecoder().decode([ReleaseFormat].self, from: json)
#expect(formats.count == 3)
#expect(formats[0] == .cd)
#expect(formats[1] == .digitalMedia)
#expect(formats[2] == .other)
}