Add tests for blocking and migration logic

This commit is contained in:
jack
2025-11-26 15:06:53 -10:00
parent 5138ce4a33
commit 5d2745eae6
2 changed files with 118 additions and 8 deletions
+19 -5
View File
@@ -11,6 +11,8 @@ import Foundation
final class MockIdentityManager: SecureIdentityStateManagerProtocol {
private let keychain: KeychainManagerProtocol
private var blockedFingerprints: Set<String> = []
private var blockedNostrPubkeys: Set<String> = []
init(_ keychain: KeychainManagerProtocol) {
self.keychain = keychain
@@ -45,19 +47,31 @@ final class MockIdentityManager: SecureIdentityStateManagerProtocol {
}
func isBlocked(fingerprint: String) -> Bool {
false
blockedFingerprints.contains(fingerprint)
}
func setBlocked(_ fingerprint: String, isBlocked: Bool) {}
func setBlocked(_ fingerprint: String, isBlocked: Bool) {
if isBlocked {
blockedFingerprints.insert(fingerprint)
} else {
blockedFingerprints.remove(fingerprint)
}
}
func isNostrBlocked(pubkeyHexLowercased: String) -> Bool {
true
blockedNostrPubkeys.contains(pubkeyHexLowercased)
}
func setNostrBlocked(_ pubkeyHexLowercased: String, isBlocked: Bool) {}
func setNostrBlocked(_ pubkeyHexLowercased: String, isBlocked: Bool) {
if isBlocked {
blockedNostrPubkeys.insert(pubkeyHexLowercased)
} else {
blockedNostrPubkeys.remove(pubkeyHexLowercased)
}
}
func getBlockedNostrPubkeys() -> Set<String> {
Set()
blockedNostrPubkeys
}
func registerEphemeralSession(peerID: PeerID, handshakeState: HandshakeState) {}