// A linked record's caption under a page's "Also linked" — "Kind in// Container · when" — moved with `LinkedRecordText` out of the People// screens.importCottonKitimportCottonValuesimport XCTest@testable importCottonUIprivatevar ist: Calendar {var out = Calendar(identifier: .gregorian) out.timeZone = TimeZone(identifier: "Asia/Kolkata")! out.locale = Locale(identifier: "en_US_POSIX")return out}privatelet kolkata = TimeZone(identifier: "Asia/Kolkata")!privatefunc at(_ iso: String) -> Date { CottonDate.parse(iso, calendar: ist)! }/// Monday 17 August 2026, quarter past three in the afternoon, in Kolkata.privatelet now = at("2026-08-17T15:00:00+05:30")finalclassLinkedRecordTextTests: XCTestCase {/// The date words a shipped table's definition gives (`linked_when`).privatefunc words(_ table: String) -> LinkedWhen? {FixtureDefinitions.load(from: Bundle(url: SourceSweep.iosSources.appendingPathComponent("CottonUI/Resources"))).definitions.first { $0.id == table }?.linkedWhen }// — which date, said in a word —// — the caption —/// RULE: The caption carries the kind's own word and the when clause it was given, unaltered.func testTheCaptionIsTheKindWordAndTheWhenClause() {let caption = LinkedRecordText.caption(kind: "todo", container: nil, when: "due Thu 20 Aug") XCTAssertTrue(caption.hasPrefix(BadgeKind.todo.label), caption) XCTAssertTrue(caption.hasSuffix("due Thu 20 Aug"), caption) }/// RULE: A container the data knows joins the caption beside the kind word; one it does not know adds nothing.func testTheContainerJoinsTheKindWordWhenTheDataKnowsOne() {let caption = LinkedRecordText.caption(kind: "event", container: "Family", when: "starts Thu") XCTAssertTrue(caption.hasPrefix(BadgeKind.event.label) && caption.contains("Family") && caption.hasSuffix("starts Thu"), caption) XCTAssertNotEqual(caption, LinkedRecordText.caption(kind: "event", container: nil, when: "starts Thu")) }/// RULE: A whitespace container is no container.func testAWhitespaceContainerIsNoContainer() { XCTAssertEqual(LinkedRecordText.caption(kind: "todo", container: " ", when: "no date"),LinkedRecordText.caption(kind: "todo", container: nil, when: "no date")) }}