Don’t auto-register mock BLE services on creation (#746)

This commit is contained in:
Islam
2025-10-05 12:36:35 +02:00
committed by GitHub
parent 6846b19d83
commit bdc31d3be3
5 changed files with 28 additions and 12 deletions
@@ -41,6 +41,31 @@ final class PrivateChatE2ETests: XCTestCase {
// MARK: - Basic Private Messaging Tests
func testSimplePrivateMessageShouldNotBeSentWithoutConnection() {
// Intentionally commented out to test
// simulateConnection(alice, bob)
let expectation = XCTestExpectation(description: "Bob should not receive a private message")
expectation.isInverted = true
bob.messageDeliveryHandler = { message in
if message.content == TestConstants.testMessage1 &&
message.isPrivate &&
message.sender == TestConstants.testNickname1 {
expectation.fulfill()
}
}
// Alice sends private message to Bob
alice.sendPrivateMessage(
TestConstants.testMessage1,
to: TestConstants.testPeerID2,
recipientNickname: TestConstants.testNickname2
)
wait(for: [expectation], timeout: TestConstants.shortTimeout)
}
func testSimplePrivateMessage() {
simulateConnection(alice, bob)
@@ -280,7 +305,6 @@ final class PrivateChatE2ETests: XCTestCase {
let service = MockBluetoothMeshService()
service.myPeerID = peerID
service.mockNickname = nickname
service._testRegister()
return service
}
@@ -423,7 +423,6 @@ final class PublicChatE2ETests: XCTestCase {
let service = MockBluetoothMeshService()
service.myPeerID = peerID
service.mockNickname = nickname
service._testRegister()
return service
}