import XCTest@testable importCottonUIfinalclassHomeHeadTitleTests: 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(trySourceSweep.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(trySourceSweep.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..<surface.endIndex)) XCTAssertTrue(surface[headBuilder.upperBound..<headEnd.lowerBound].contains("HomeHead(face: personRead.face)"), "the head is the person from the window's box")let page = try XCTUnwrap(surface.range(of: "private var homePage: some View"), "Home's page is drawn in BoardSurface")let pageEnd = try XCTUnwrap(surface.range(of: "\n }\n", range: page.upperBound..<surface.endIndex))let pageBody = surface[page.upperBound..<pageEnd.lowerBound] XCTAssertTrue(pageBody.contains("parts(homeHead: true)"), "Home's page asks the parts for the person's head") XCTAssertFalse(pageBody.contains("GridTile.home"), "Home's screen carries no title of its own over the head") }}