import XCTest @testable import CottonUI final class HomeHeadTitleTests: XCTestCase { /// RULE: the Home head never carries a word that is not the face's name — the page's title is the person's name, drawn once from the face read, and nothing stands in for it before the read answers; the fan card's label is never drawn on the page (the owner's 289 screenshots: "Me" twice, a fallback word, and placeholders are forbidden). func testTheHomeHeadCarriesOnlyTheFacesName() throws { XCTAssertNil(HomeHeadTitle.of(nil), "before the read answers the head draws no word") XCTAssertNil(HomeHeadTitle.of(HomeFace(name: "", picture: nil, seed: "p-heron")), "a face with no name draws no word") XCTAssertEqual(HomeHeadTitle.of(HomeFace(name: "Heron", picture: nil, seed: "p-heron")), "Heron") let head = SourceSweep.withoutComments( try SourceSweep.mustRead("apps/cotton/Sources/CottonUI/Surfaces/HomeHead.swift", ownedBy: "home")) XCTAssertFalse(head.contains("GridTile.home"), "the head never draws the fan card's word") XCTAssertFalse(head.contains("HomeFace(name: \"\""), "the head never draws a stand-in face before the read") let surface = SourceSweep.withoutComments( try SourceSweep.mustRead("apps/cotton/Sources/CottonUI/Surfaces/BoardSurface.swift", ownedBy: "home")) let headBuilder = try XCTUnwrap(surface.range(of: "private var homeHead: AnyView"), "Home's head is its own builder in BoardSurface") let headEnd = try XCTUnwrap(surface.range(of: "\n }\n", range: headBuilder.upperBound..