Files
Termind/FrameworkTests/KnownHostPresentationTests.swift

31 lines
963 B
Swift

// SPDX-FileCopyrightText: 2026 Kaede Akino
// SPDX-License-Identifier: GPL-3.0-only
import TermindDomain
import TermindPresentation
import Testing
@Suite("Known Host presentation")
struct KnownHostPresentationTests {
@Test func hashedEntriesHideTheirWireTokenFromTheCardTitle() {
let hashed = KnownHostEntry(
hostname: "|1|salt|hash",
port: 22,
algorithm: .ed25519,
fingerprint: "SHA256:test"
)
let plain = KnownHostEntry(
hostname: "example.invalid",
port: 2222,
algorithm: .ed25519,
fingerprint: "SHA256:test"
)
#expect(!hashed.presentationTitle.isEmpty)
#expect(!hashed.presentationTitle.contains(hashed.hostname))
#expect(!hashed.presentationTitle.contains("salt"))
#expect(!hashed.presentationTitle.contains("hash"))
#expect(plain.presentationTitle == plain.displayAddress)
}
}