importCottonKit@testable importCottonUIimport XCTestfinalclassBusinessFlavourWordsTests: XCTestCase {privatefunc shipped(_ flavour: String) throws -> FlavourManifest {try JSONDecoder().decode(FlavourManifest.self, from: Data(BusinessFake.manifest(flavour).utf8)) }/// RULE: The name Cotton appears nowhere in a business flavour: its build line says the business's name ("Sharmila's Yoga Zone 1.0.0 (1) · sha"), its first screen hands over to no Cotton screen — no "Work here? Join the business's database", no "Join your Cotton" — and every line its customer section can say is the business's own (architect, 20 Oct 2026, from Sharmila 1 and Nancy 1 on the owner's phone).func testABusinessFlavourNeverSaysCotton() throws {for flavour in ["kitchen"] {let manifest = try shipped(flavour)let line = BuildLine.own(app: BuildLine.name(of: manifest), version: "1.0.0", build: "1", commit: "0123456789") XCTAssertEqual(line, "\(manifest.name) 1.0.0 (1) · 0123456") } XCTAssertEqual(BuildLine.name(of: nil), "Cotton", "Cotton's own build still says Cotton")let start = SourceSweep.withoutComments(trySourceSweep.mustRead("apps/cotton/Sources/CottonUI/Join/CustomerShell.swift", ownedBy: "phone2")) XCTAssertFalse(start.contains("CottonStrings."), "the business's first screen draws a Cotton string")let customer = SourceSweep.withoutComments(trySourceSweep.mustRead("apps/cotton/Sources/CottonUI/Surfaces/Board/HomeCustomer.swift", ownedBy: "phonewalk")) XCTAssertFalse(customer.contains("CottonStrings."), "the customer section draws a Cotton string") }/// RULE: No gate screen and no error says Cotton in a business flavour: every table sentence (`CottonStrings.local`) and every error's words (`CottonCallError`, `CottonClientError`) are said in the flavour's name — the waiting, refusal, erase and unsent screens a business's customer can land on said "Cotton is opening…", "Join your Cotton", "Erase Cotton from this iPhone" (lane phonewalk, 19 Oct 2026). Cotton's own build still says Cotton.func testNoGateScreenOrErrorSaysCottonInABusinessFlavour() throws {defer { ShellLines.speaker = FlavourManifest.current?.name }for flavour in ["kitchen"] {let manifest = try shipped(flavour)ShellLines.speaker = manifest.namelet gate: [String] = [CottonStrings.eraseCottonFromThisPhone, CottonStrings.eraseConfirmTitle,CottonStrings.eraseConfirmBody, CottonStrings.refusalUpgradeTitle, CottonStrings.refusalNoWorkspaceTitle,CottonStrings.refusalSignupClosedTitle,CottonStrings.readOnlyHeld, ]for line in gate { XCTAssertFalse(line.contains("Cotton"), "\(flavour): \(line)") } XCTAssertTrue(CottonStrings.eraseCottonFromThisPhone.contains(manifest.name))let errors: [any LocalizedError] = [CottonCallError(code: "x", message: ""), CottonCallError(code: "x", message: "Cotton refused."),CottonClientError.malformedAnswer("{}"), ]for error in errors { XCTAssertFalse(FlavourManifest.said(try XCTUnwrap(error.errorDescription), by: manifest).contains("Cotton"), flavour) }// Every sentence in the tables, as this flavour says it.for (name, text) intrySourceSweep.swiftSources() {for match in text.matches(of: /local\("((?:[^"\\]|\\.)*)"\)/) where match.1.contains("Cotton") { XCTAssertFalse(FlavourManifest.said(String(match.1), by: manifest).contains("Cotton"), "\(flavour): \(name): \(match.1)") } } }ShellLines.speaker = nil XCTAssertTrue(CottonStrings.eraseCottonFromThisPhone.contains("Cotton"), "Cotton's own build still says Cotton")let errors = SourceSweep.withoutComments(trySourceSweep.mustRead("apps/cotton/Sources/CottonKit/CottonCore.swift", ownedBy: "phone2")) XCTAssertEqual(errors.components(separatedBy: "FlavourManifest.said(").count - 1, 2, "both error descriptions resolve from the flavour") }/// RULE: Everyone signs in to a business with a number and a code, the owner included, so the sign-in sheet's fields are the number and the code — and, once, from a stranger the object asks it of, a name — and `business.signIn` carries nothing more (the owner's ruling via the architect, 20 Oct 2026, removing the separate owner-code field).func testTheSignInSheetAsksOnlyTheNumberAndTheCode() throws {let customer = SourceSweep.withoutComments(trySourceSweep.mustRead("apps/cotton/Sources/CottonUI/Surfaces/Board/HomeCustomer.swift", ownedBy: "phonewalk")) XCTAssertEqual(customer.components(separatedBy: "PaperTextField(").count - 1, 3, "the sheet's fields are the number, the code and a stranger's name") XCTAssertTrue(customer.contains("home-customer-phone") && customer.contains("home-customer-code"))let signIn = SourceSweep.withoutComments(trySourceSweep.mustRead("apps/cotton/Sources/CottonKit/BusinessClient.swift", ownedBy: "business"))for extra in ["ownerCode", "ownerUnclaimed"] { XCTAssertFalse(customer.contains(extra) || signIn.contains(extra), "the sign-in asks for \(extra)") } }/// RULE: No message that came with a refused call is drawn to a business's customer: the core's and the server's sentences are composed for the Mac or a log, and "This Mac is not connected to a server yet, so there is nothing to sync or import into. Connect it from the menu bar first." reached Sharmila's and Nancy's customers that way (20 Oct 2026). The customer reads the phone's own line by the refusal's code — the business's name and "cannot be reached right now" when it was not reached.func testNoMacSentenceReachesACustomer() throws {let customer = SourceSweep.withoutComments(trySourceSweep.mustRead("apps/cotton/Sources/CottonUI/Surfaces/Board/HomeCustomer.swift", ownedBy: "phonewalk")) XCTAssertFalse(customer.contains(".message"), "the customer section draws a refused call's own message") XCTAssertFalse(customer.contains("localizedDescription"), "the customer section draws an error's description") }/// RULE: A customer sheet sets no refusal of its own: every refusal is the kit's customer line by code (`HomeCustomerRefusal.line`), never a sentence composed on the phone. Shared lines hid unfinished business setup as a bad phone number (architect, 20 Oct 2026).func testEveryCustomerRefusalIsTheDefinitionsLineByCode() throws {let customer = SourceSweep.withoutComments(trySourceSweep.mustRead("apps/cotton/Sources/CottonUI/Surfaces/Board/HomeCustomer.swift", ownedBy: "phone2"))for assignment in customer.components(separatedBy: "refusal = ").dropFirst() { XCTAssertTrue(assignment.hasPrefix("HomeCustomerRefusal.line(") || assignment.hasPrefix("nil") || assignment.hasPrefix("model.refusal") || assignment.hasPrefix("model.signInRefusal"),"a customer sheet sets a refusal of its own: \(assignment.prefix(60))") }for composed in ["did not work", "Try again.\"", "cannot be reached", "is full"] { XCTAssertFalse(customer.contains(composed), "the customer sheets compose \(composed)") } }}