// `/settings#sync` — the four sentences that ARE this screen. // // Two groups of cases. // // **The sync activity** — the `liveLabel` / `outboxLabel` / `backupLabel` block, // exhaustively. Its `backupLine`, `outboxLine` and `activityLine` blocks are NOT // here: those three compose the chat list's one quiet second line, not this // screen's cards, and they belong with the messages surface. Its `importLine` // block is not here either — see the PORT GAP in `SyncBackupWords.swift`: the // import activity has no source on this branch, so there is nothing to test and // a stub would be a test of a stub. // // **The screen itself** — its four cases are about what the cards SAY, and every // one of them is a case over these functions plus `failedFileLine`. The rendered // half (which control holds which text) is dropped with a reason: the screen is // a `Text` per sentence and asserting the SwiftUI tree would pin the rendering // rather than the choice. The "Sync now runs one // cycle" case is `SyncModel`'s own and is tested where that model is. // // Every fixture is synthetic. import CottonKit import XCTest @testable import CottonUI final class SyncScreenTests: XCTestCase { private func counts( pending: Int = 0, synced: Int = 12, failed: Int = 0, deletePending: Int = 0 ) -> MediaActivityRead.Counts { MediaActivityRead.Counts( pending: pending, synced: synced, failed: failed, deletePending: deletePending ) } // ── Sync, in the same words ────────────────────────────────────────── private let syncing = DatabaseSyncLine( state: .syncing, words: "syncing · 62%", page: "Syncing · 62% · 41,000 changes to go", percent: 62, toGo: 41_000, coming: ["Email · 41,000 of 58,900", "Everything else · up to date"]) // ── The last try ───────────────────────────────────────────────────── // ── What is coming ─────────────────────────────────────────────────── // ── The ledger ─────────────────────────────────────────────────────── // ── The files that could not be backed up ──────────────────────────── // ── The last-synced line ───────────────────────────────────────────── // ── The ledger's three shapes, decoded ─────────────────────────────── } /// The one behaviour on this screen that is not a sentence: the button runs a /// cycle. @MainActor final class SyncNowTests: XCTestCase { }