import CottonKit @testable import CottonUI import XCTest /// RULE: an event's people are never cut mid-name. The face tries every whole /// name, then first names, then fewer first names and how many more ("Priya, /// Arjun and 1 more"), all in the core's own list words, and draws the first /// telling that fits its lines (coordinator's review, 24 Oct 2026). final class EventNamesTests: XCTestCase { func testThreePeopleAreToldShorterAndShorter() { let separator = ShellLines.line("home", "done.separator") let tellings = EventNames.tellings(["Priya Example", "Arjun Rao", "Meera Iyer"]) XCTAssertEqual(tellings.first, ["Priya Example", "Arjun Rao", "Meera Iyer"].joined(separator: ShellLines.line("cards", "join"))) XCTAssertEqual(tellings[1], ["Priya", "Arjun", "Meera"].joined(separator: separator)) XCTAssertEqual(tellings[2], ShellLines.line("home", "done.and_more", ["list": ["Priya", "Arjun"].joined(separator: separator), "n": "1"])) XCTAssertEqual(tellings.last, ShellLines.line("home", "done.and_more", ["list": "Priya", "n": "2"])) XCTAssertEqual(tellings.count, 4) } func testOneFirstNameIsToldOnce() { XCTAssertEqual(EventNames.tellings(["Meera"]), ["Meera"]) } func testTheLongestTellingThatFitsIsSet() { let names = ["Priya Example", "Arjun Rao", "Meera Iyer"] let tellings = EventNames.tellings(names) XCTAssertEqual(EventNames.telling(names, size: 19, width: 2000, lines: 1), tellings.first, "room for every whole name") XCTAssertEqual(EventNames.telling(names, size: 19, width: 10, lines: 2), tellings.last, "no room says the fewest") XCTAssertEqual(EventNames.telling(["Meera Iyer"], size: 19, width: 250, lines: 2), "Meera Iyer", "one whole name that fits stays whole") } }