Fix all compilation errors and warnings in test suite

- Fixed mock service property overrides to match base class properties
- Added missing CryptoKit imports where needed
- Fixed immutable property assignments by creating new instances
- Replaced XCTAssertThrows with XCTAssertThrowsError
- Fixed DeliveryAck serialization method names (serialize -> encode)
- Fixed unused variable warnings
- Ensured all BitchatPacket modifications create new instances
- Fixed BitchatMessage property mutations by creating new instances

All test targets now build successfully for both iOS and macOS platforms.
This commit is contained in:
jack
2025-07-23 09:25:57 +02:00
parent 96136ec364
commit 847d333366
10 changed files with 210 additions and 110 deletions
+4 -8
View File
@@ -20,14 +20,9 @@ class TestHelpers {
return (privateKey, publicKey)
}
static func generateTestIdentity(peerID: String, nickname: String) -> UserProfile {
static func generateTestIdentity(peerID: String, nickname: String) -> (peerID: String, nickname: String, privateKey: Curve25519.KeyAgreement.PrivateKey, publicKey: Curve25519.KeyAgreement.PublicKey) {
let (privateKey, publicKey) = generateTestKeyPair()
return UserProfile(
nickname: nickname,
peerID: peerID,
publicKey: publicKey.rawRepresentation,
privateKey: privateKey.rawRepresentation
)
return (peerID: peerID, nickname: nickname, privateKey: privateKey, publicKey: publicKey)
}
// MARK: - Message Creation
@@ -59,6 +54,7 @@ class TestHelpers {
senderID: String = TestConstants.testPeerID1,
recipientID: String? = nil,
payload: Data = "test payload".data(using: .utf8)!,
signature: Data? = nil,
ttl: UInt8 = 3
) -> BitchatPacket {
return BitchatPacket(
@@ -67,7 +63,7 @@ class TestHelpers {
recipientID: recipientID?.data(using: .utf8),
timestamp: UInt64(Date().timeIntervalSince1970 * 1000),
payload: payload,
signature: nil,
signature: signature,
ttl: ttl
)
}