diff --git a/features/call/test/src/main/kotlin/io/element/android/features/call/test/FakeCurrentCallService.kt b/features/call/test/src/main/kotlin/io/element/android/features/call/test/FakeCurrentCallService.kt index ff0a9e9096..b9efc70ece 100644 --- a/features/call/test/src/main/kotlin/io/element/android/features/call/test/FakeCurrentCallService.kt +++ b/features/call/test/src/main/kotlin/io/element/android/features/call/test/FakeCurrentCallService.kt @@ -12,11 +12,5 @@ import io.element.android.features.call.api.CurrentCallService import kotlinx.coroutines.flow.MutableStateFlow class FakeCurrentCallService( - initialValue: CurrentCall = CurrentCall.None, -) : CurrentCallService { - override val currentCall = MutableStateFlow(initialValue) - - fun setCurrentCall(value: CurrentCall) { - currentCall.value = value - } -} + override val currentCall: MutableStateFlow = MutableStateFlow(CurrentCall.None), +) : CurrentCallService diff --git a/features/roomcall/impl/src/test/kotlin/io/element/android/features/roomcall/impl/RoomCallStatePresenterTest.kt b/features/roomcall/impl/src/test/kotlin/io/element/android/features/roomcall/impl/RoomCallStatePresenterTest.kt index ba0b425ec5..d29bff08ff 100644 --- a/features/roomcall/impl/src/test/kotlin/io/element/android/features/roomcall/impl/RoomCallStatePresenterTest.kt +++ b/features/roomcall/impl/src/test/kotlin/io/element/android/features/roomcall/impl/RoomCallStatePresenterTest.kt @@ -16,6 +16,7 @@ import io.element.android.libraries.matrix.api.room.MatrixRoom import io.element.android.libraries.matrix.test.room.FakeMatrixRoom import io.element.android.libraries.matrix.test.room.aRoomInfo import io.element.android.tests.testutils.test +import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runTest import org.junit.Test @@ -112,7 +113,7 @@ class RoomCallStatePresenterTest { } val presenter = createRoomCallStatePresenter( matrixRoom = room, - currentCallService = FakeCurrentCallService(initialValue = CurrentCall.RoomCall(room.roomId)), + currentCallService = FakeCurrentCallService(MutableStateFlow(CurrentCall.RoomCall(room.roomId))), ) presenter.test { skipItems(1) @@ -138,7 +139,8 @@ class RoomCallStatePresenterTest { ) ) } - val currentCallService = FakeCurrentCallService(initialValue = CurrentCall.RoomCall(room.roomId)) + val currentCall = MutableStateFlow(CurrentCall.RoomCall(room.roomId)) + val currentCallService = FakeCurrentCallService(currentCall = currentCall) val presenter = createRoomCallStatePresenter( matrixRoom = room, currentCallService = currentCallService @@ -152,7 +154,7 @@ class RoomCallStatePresenterTest { isUserLocallyInTheCall = true, ) ) - currentCallService.setCurrentCall(CurrentCall.None) + currentCall.value = CurrentCall.None assertThat(awaitItem()).isEqualTo( RoomCallState.OnGoing( canJoinCall = true,