#if canImport(UIKit)@testable importCottonFaces@testable importCottonUIimportCottonValuesimport XCTest/// RULE: a card naming a face this build does not draw — a placeholder a kit/// names before its face exists (a pending id, `faces-pending.json`), or a/// face newer than the build — is never a blank card: the tool's list draws/// its records as slips (no deck), and a record opened alone is drawn by the/// plain face. Music's three (`album.sleeve`, `song.single`,/// `artist.divider`, 4 Nov 2026) were pending when the kit named them and are/// drawn now: their decks are decks.finalclassUndrawnFaceTests: XCTestCase {/// Music's tables as the personal kit defines them, and the face each names.privatestaticlet music: [(table: String, face: DefinitionCardKind)] = [ ("music_album", .albumSleeve), ("song", .songSingle), ("artist", .artistDivider), ]/// An invented table naming a face still pending.privatefunc pending() throws -> TableDefinition {try JSONDecoder().decode(TableDefinition.self, from: Data(""" {"format_version": 1, "id": "invented", "name": "Invented", "plural": "Invented", "columns": [{"key": "title", "name": "Title", "type": "text"}], "title": "title", "slip": {"title": "title"}, "tile": {"face": "slip-list"}, "card": {"face": "message", "fields": [{"slot": "title", "column": "title"}]}} """.utf8)) } @MainActorfunc testAPendingFaceIsReadAndDrawnAsSlipsNotADeck() throws {let definition = try pending() XCTAssertEqual(definition.card?.face.rawValue, "message", "the kit's pending id reads") XCTAssertFalse(FaceRegistry.ids.contains("message"), "no face draws it yet") XCTAssertFalse(DeckSwitch.draws(definition, view: nil, plain: true), "the list stays the slips") XCTAssertNotNil(definition.slip, "and the slips are what the definition draws") } @MainActorfunc testMusicsFacesAreDrawnNow() throws {for (table, face) inSelf.music {let definition = tryTableDefinition.decode(Data(contentsOf: SourceSweep.kitTable(table))) XCTAssertEqual(definition.card?.face, face, "\(table) names \(face.rawValue)") XCTAssertTrue(FaceRegistry.ids.contains(face.rawValue), "Loom draws \(face.rawValue)") XCTAssertTrue(DeckFace.draws(face)) } }/// Cinemas' faces (5 Nov 2026): a film's one-sheet and an episode's/// lobby card are drawn, so their decks are decks. @MainActorfunc testCinemasFacesAreDrawn() throws {for (table, face) in [("film", "film.poster"), ("film_episode", "episode.lobby")] {let definition = tryTableDefinition.decode(Data(contentsOf: SourceSweep.kitTable(table)))let named = try XCTUnwrap(definition.card).face XCTAssertEqual(named.rawValue, face, "\(table) names \(face)") XCTAssertTrue(FaceRegistry.ids.contains(face), "Loom draws \(face)") XCTAssertTrue(DeckFace.draws(named)) } } @MainActorfunc testARecordOpenedAloneIsDrawnByThePlainFace() { XCTAssertNotNil(FaceRegistry.face("plain"), "the plain face is one this build draws")for face in ["message", "song.newer-than-this-build"] {let card = DeckCard(face: face, corner: nil, pressing: false, pace: nil, plate: nil, fields: ["title": .text("Invented Lantern")]) XCTAssertFalse(DeckFace.draws(card)) XCTAssertNil(DeckFace.registered(card), "no registered face for \(face), so the plain face draws it") } }}#endif