Started off well

This commit is contained in:
cdricms
2026-03-21 17:25:07 +01:00
commit ada1c12f57
9 changed files with 1164 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
import Foundation
import Testing
@testable import MusicBrainz
@Test func testArtistSearchDecoding() throws {
let json = """
{
"created": "2026-03-20T22:42:03.521Z",
"count": 1,
"offset": 0,
"artists": [
{
"id": "f27ec8db-af05-4f36-916e-3d57f91ecf5e",
"type": "Person",
"name": "Michael Jackson",
"sort-name": "Jackson, Michael",
"country": "US",
"disambiguation": "King of Pop"
}
]
}
""".data(using: .utf8)!
let response = try JSONDecoder().decode(SearchResponse<Artist>.self, from: json)
#expect(response.count == 1)
#expect(response.entities.count == 1)
#expect(response.entities[0].name == "Michael Jackson")
}