From f5451e5e174426550fd67da72893cb3008de1b21 Mon Sep 17 00:00:00 2001 From: Valere Date: Tue, 24 Mar 2026 08:43:31 +0100 Subject: [PATCH] fix tests --- ElementX/Sources/Services/Room/Room.swift | 2 +- UnitTests/Sources/RoomTests.swift | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ElementX/Sources/Services/Room/Room.swift b/ElementX/Sources/Services/Room/Room.swift index 58aae9c9b..329023d26 100644 --- a/ElementX/Sources/Services/Room/Room.swift +++ b/ElementX/Sources/Services/Room/Room.swift @@ -9,7 +9,7 @@ import MatrixRustSDK extension RoomProtocol { - func joinCallIntent(voiceOnly: Bool) async -> Intent { + func joinCallIntent(voiceOnly: Bool = false) async -> Intent { switch await (hasActiveRoomCall(), isDirect()) { case (true, true): voiceOnly ? .joinExistingDmVoice : .joinExistingDm case (true, false): .joinExisting diff --git a/UnitTests/Sources/RoomTests.swift b/UnitTests/Sources/RoomTests.swift index 67b9538e3..92dc7fb49 100644 --- a/UnitTests/Sources/RoomTests.swift +++ b/UnitTests/Sources/RoomTests.swift @@ -18,19 +18,25 @@ struct RoomTests { room.hasActiveRoomCallReturnValue = false room.isDirectReturnValue = false - var callIntent = await room.joinCallIntent + var callIntent = await room.joinCallIntent() #expect(callIntent == .startCall) - + room.isDirectReturnValue = true - callIntent = await room.joinCallIntent + callIntent = await room.joinCallIntent() #expect(callIntent == .startCallDm) + callIntent = await room.joinCallIntent(voiceOnly: true) + #expect(callIntent == .startCallDmVoice) + room.hasActiveRoomCallReturnValue = true - callIntent = await room.joinCallIntent + callIntent = await room.joinCallIntent() #expect(callIntent == .joinExistingDm) + callIntent = await room.joinCallIntent(voiceOnly: true) + #expect(callIntent == .joinExistingDmVoice) + room.isDirectReturnValue = false - callIntent = await room.joinCallIntent + callIntent = await room.joinCallIntent() #expect(callIntent == .joinExisting) } }