Fix 3 nicht funktionierende Alert-Dismiss-Buttons (M34)

README-Milestone-Nachcheck (Port-Konflikt-Prüfung/"Fertig"-Button)
deckte drei eigenständige Bugs derselben Klasse auf: Cancel/OK-Buttons
bei ReviewApplyViews Apply-Fehler-Alert, ConnectViews
Zertifikat-Alert und ConnectViews SSH-Hostkey-Alert taten nichts oder
zu wenig - der jeweilige Verbindungs-/Fehlerzustand blieb hängen,
der Dialog konnte nicht sauber verlassen werden.

Neue ConnectionService.cancelPendingTrustConfirmation() und
SetupViewModel.dismissApplyError(), alle drei Alerts korrekt
verdrahtet (Button-Action + Bindings-Setter fuer Tap-Outside/Esc).
Totes dismissPendingSSHTrust() entfernt. 1 neuer Regressionstest,
alle 102 Unit-Tests gruen.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Kay
2026-09-17 21:04:01 +02:00
co-authored by Claude Sonnet 5
parent 510e750b3c
commit 4810b7df63
9 changed files with 139 additions and 11 deletions
@@ -70,6 +70,25 @@ final class ConnectionServiceTests: XCTestCase {
XCTAssertEqual(service.state, .needsCertificateConfirmation(fingerprint: "AA:BB"))
}
/// Regression test for the README milestone re-check, 2026-09-17: `ConnectView`'s
/// "Abbrechen" button on the certificate-trust alert previously had an empty action and could
/// never actually clear `state` back out of `.needsCertificateConfirmation`, so the alert
/// (whose `isPresented` binding is derived from `state`) could never really be dismissed.
func testCancelPendingTrustConfirmationResetsCertificateConfirmationToIdle() async {
let service = ConnectionService()
await service.connect(
with: credentials,
makeRestTransport: { MockTransport(kind: .rest, connectError: RouterOSError.untrustedCertificate(fingerprint: "AA:BB")) },
makeSSHTransport: { MockTransport(kind: .ssh) }
)
XCTAssertEqual(service.state, .needsCertificateConfirmation(fingerprint: "AA:BB"))
service.cancelPendingTrustConfirmation()
XCTAssertEqual(service.state, .idle)
}
func testFailsWhenBothTransportsFail() async {
let service = ConnectionService()