Test instrument catalog metadata
This commit is contained in:
@@ -0,0 +1,38 @@
|
|||||||
|
import MusicAssistantCore
|
||||||
|
import XCTest
|
||||||
|
|
||||||
|
final class InstrumentCatalogItemTests: XCTestCase {
|
||||||
|
func testCatalogItemStoresStructuredInstrumentMetadata() {
|
||||||
|
let item = InstrumentCatalogItem(
|
||||||
|
id: "oud",
|
||||||
|
name: "Oud",
|
||||||
|
familyCategory: "Plucked strings",
|
||||||
|
regionOrigin: "Middle East",
|
||||||
|
aliases: ["Arabic lute"],
|
||||||
|
searchTerms: ["ud", "عود"]
|
||||||
|
)
|
||||||
|
|
||||||
|
XCTAssertEqual(item.id, "oud")
|
||||||
|
XCTAssertEqual(item.name, "Oud")
|
||||||
|
XCTAssertEqual(item.familyCategory, "Plucked strings")
|
||||||
|
XCTAssertEqual(item.regionOrigin, "Middle East")
|
||||||
|
XCTAssertEqual(item.aliases, ["Arabic lute"])
|
||||||
|
XCTAssertEqual(item.searchTerms, ["ud", "عود"])
|
||||||
|
}
|
||||||
|
|
||||||
|
func testCatalogItemSupportsOptionalMetadataAndRoundTripsThroughJSON() throws {
|
||||||
|
let item = InstrumentCatalogItem(
|
||||||
|
id: "synthesizer",
|
||||||
|
name: "Synthesizer",
|
||||||
|
familyCategory: "Electronic"
|
||||||
|
)
|
||||||
|
|
||||||
|
let data = try JSONEncoder().encode(item)
|
||||||
|
let decodedItem = try JSONDecoder().decode(InstrumentCatalogItem.self, from: data)
|
||||||
|
|
||||||
|
XCTAssertNil(item.regionOrigin)
|
||||||
|
XCTAssertEqual(item.aliases, [])
|
||||||
|
XCTAssertEqual(item.searchTerms, [])
|
||||||
|
XCTAssertEqual(decodedItem, item)
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -75,7 +75,7 @@ requirement is missing and blocks implementation, record it in
|
|||||||
|
|
||||||
## Phase 6 --- Instrument Selector & Catalog
|
## Phase 6 --- Instrument Selector & Catalog
|
||||||
|
|
||||||
- [ ] Create structured catalog models for instrument id, name,
|
- [x] Create structured catalog models for instrument id, name,
|
||||||
family/category, optional region/origin and aliases/search terms.
|
family/category, optional region/origin and aliases/search terms.
|
||||||
- [ ] Provide large worldwide catalog data covering Western, Middle
|
- [ ] Provide large worldwide catalog data covering Western, Middle
|
||||||
Eastern, African, South Asian, East Asian, Southeast Asian, Latin
|
Eastern, African, South Asian, East Asian, Southeast Asian, Latin
|
||||||
|
|||||||
Reference in New Issue
Block a user