mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Add missing tests on CallType and make it internal.
This commit is contained in:
@@ -31,10 +31,3 @@ sealed interface CallType : NodeInputs, Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun CallType.getSessionId(): SessionId? {
|
|
||||||
return when (this) {
|
|
||||||
is CallType.ExternalUrl -> null
|
|
||||||
is CallType.RoomCall -> sessionId
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2025 New Vector Ltd.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
|
* Please see LICENSE files in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.element.android.features.call.impl.ui
|
||||||
|
|
||||||
|
import io.element.android.features.call.api.CallType
|
||||||
|
import io.element.android.libraries.matrix.api.core.SessionId
|
||||||
|
|
||||||
|
fun CallType.getSessionId(): SessionId? {
|
||||||
|
return when (this) {
|
||||||
|
is CallType.ExternalUrl -> null
|
||||||
|
is CallType.RoomCall -> sessionId
|
||||||
|
}
|
||||||
|
}
|
||||||
-1
@@ -36,7 +36,6 @@ import dev.zacsweers.metro.Inject
|
|||||||
import io.element.android.compound.colors.SemanticColorsLightDark
|
import io.element.android.compound.colors.SemanticColorsLightDark
|
||||||
import io.element.android.features.call.api.CallType
|
import io.element.android.features.call.api.CallType
|
||||||
import io.element.android.features.call.api.CallType.ExternalUrl
|
import io.element.android.features.call.api.CallType.ExternalUrl
|
||||||
import io.element.android.features.call.api.getSessionId
|
|
||||||
import io.element.android.features.call.impl.DefaultElementCallEntryPoint
|
import io.element.android.features.call.impl.DefaultElementCallEntryPoint
|
||||||
import io.element.android.features.call.impl.di.CallBindings
|
import io.element.android.features.call.impl.di.CallBindings
|
||||||
import io.element.android.features.call.impl.pip.PictureInPictureEvents
|
import io.element.android.features.call.impl.pip.PictureInPictureEvents
|
||||||
|
|||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2025 New Vector Ltd.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
|
* Please see LICENSE files in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.element.android.features.call.ui
|
||||||
|
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
|
import io.element.android.features.call.api.CallType
|
||||||
|
import io.element.android.features.call.impl.ui.getSessionId
|
||||||
|
import io.element.android.libraries.matrix.test.A_ROOM_ID
|
||||||
|
import io.element.android.libraries.matrix.test.A_SESSION_ID
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
class CallTypeTest {
|
||||||
|
@Test
|
||||||
|
fun `getSessionId returns null for ExternalUrl`() {
|
||||||
|
assertThat(CallType.ExternalUrl("aURL").getSessionId()).isNull()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `getSessionId returns the sessionId for RoomCall`() {
|
||||||
|
assertThat(
|
||||||
|
CallType.RoomCall(
|
||||||
|
sessionId = A_SESSION_ID,
|
||||||
|
roomId = A_ROOM_ID,
|
||||||
|
).getSessionId()
|
||||||
|
).isEqualTo(A_SESSION_ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `ExternalUrl stringification does not contain the URL`() {
|
||||||
|
assertThat(CallType.ExternalUrl("aURL").toString()).isEqualTo("ExternalUrl")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `RoomCall stringification does not contain the URL`() {
|
||||||
|
assertThat(CallType.RoomCall(A_SESSION_ID, A_ROOM_ID).toString())
|
||||||
|
.isEqualTo("RoomCall(sessionId=$A_SESSION_ID, roomId=$A_ROOM_ID)")
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user