fix tests
This commit is contained in:
parent
e1365f1fd2
commit
902b7937c3
2 changed files with 20 additions and 5 deletions
|
|
@ -23,6 +23,7 @@ import io.element.android.features.userprofile.shared.aUserProfileState
|
||||||
import io.element.android.libraries.architecture.AsyncData
|
import io.element.android.libraries.architecture.AsyncData
|
||||||
import io.element.android.libraries.matrix.api.core.RoomId
|
import io.element.android.libraries.matrix.api.core.RoomId
|
||||||
import io.element.android.libraries.matrix.api.core.UserId
|
import io.element.android.libraries.matrix.api.core.UserId
|
||||||
|
import io.element.android.libraries.matrix.api.notification.CallIntent
|
||||||
import io.element.android.libraries.matrix.test.AN_AVATAR_URL
|
import io.element.android.libraries.matrix.test.AN_AVATAR_URL
|
||||||
import io.element.android.libraries.matrix.test.A_ROOM_ID
|
import io.element.android.libraries.matrix.test.A_ROOM_ID
|
||||||
import io.element.android.libraries.matrix.test.A_USER_ID
|
import io.element.android.libraries.matrix.test.A_USER_ID
|
||||||
|
|
@ -105,7 +106,7 @@ class UserProfileViewTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `on Call clicked - the expected callback is called`() = runTest {
|
fun `on Call clicked - the expected callback is called`() = runTest {
|
||||||
ensureCalledOnceWithParam(A_ROOM_ID) { callback ->
|
ensureCalledOnceWithTwoParams(A_ROOM_ID, CallIntent.AUDIO) { callback ->
|
||||||
rule.setUserProfileView(
|
rule.setUserProfileView(
|
||||||
state = aUserProfileState(
|
state = aUserProfileState(
|
||||||
dmRoomId = A_ROOM_ID,
|
dmRoomId = A_ROOM_ID,
|
||||||
|
|
@ -117,6 +118,20 @@ class UserProfileViewTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `on Video Call clicked - the expected callback is called`() = runTest {
|
||||||
|
ensureCalledOnceWithTwoParams(A_ROOM_ID, CallIntent.VIDEO) { callback ->
|
||||||
|
rule.setUserProfileView(
|
||||||
|
state = aUserProfileState(
|
||||||
|
dmRoomId = A_ROOM_ID,
|
||||||
|
canCall = true,
|
||||||
|
),
|
||||||
|
onStartCall = callback,
|
||||||
|
)
|
||||||
|
rule.clickOn(CommonStrings.common_video)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Config(qualifiers = "h1024dp")
|
@Config(qualifiers = "h1024dp")
|
||||||
@Test
|
@Test
|
||||||
fun `on Block user clicked - a BlockUser event is emitted with needsConfirmation`() = runTest {
|
fun `on Block user clicked - a BlockUser event is emitted with needsConfirmation`() = runTest {
|
||||||
|
|
@ -216,7 +231,7 @@ private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setUserP
|
||||||
),
|
),
|
||||||
onShareUser: () -> Unit = EnsureNeverCalled(),
|
onShareUser: () -> Unit = EnsureNeverCalled(),
|
||||||
onDmStarted: (RoomId) -> Unit = EnsureNeverCalledWithParam(),
|
onDmStarted: (RoomId) -> Unit = EnsureNeverCalledWithParam(),
|
||||||
onStartCall: (RoomId) -> Unit = EnsureNeverCalledWithParam(),
|
onStartCall: (RoomId, CallIntent) -> Unit = EnsureNeverCalledWithTwoParams(),
|
||||||
onVerifyClick: (UserId) -> Unit = EnsureNeverCalledWithParam(),
|
onVerifyClick: (UserId) -> Unit = EnsureNeverCalledWithParam(),
|
||||||
goBack: () -> Unit = EnsureNeverCalled(),
|
goBack: () -> Unit = EnsureNeverCalled(),
|
||||||
openAvatarPreview: (String, String) -> Unit = EnsureNeverCalledWithTwoParams(),
|
openAvatarPreview: (String, String) -> Unit = EnsureNeverCalledWithTwoParams(),
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@ class AccountManagementActionKtTest {
|
||||||
assertThat(AccountManagementAction.Profile.toRustAction())
|
assertThat(AccountManagementAction.Profile.toRustAction())
|
||||||
.isEqualTo(RustAccountManagementAction.Profile)
|
.isEqualTo(RustAccountManagementAction.Profile)
|
||||||
assertThat(AccountManagementAction.SessionEnd(A_DEVICE_ID).toRustAction())
|
assertThat(AccountManagementAction.SessionEnd(A_DEVICE_ID).toRustAction())
|
||||||
.isEqualTo(RustAccountManagementAction.SessionEnd(A_DEVICE_ID.value))
|
.isEqualTo(RustAccountManagementAction.DeviceDelete(A_DEVICE_ID.value))
|
||||||
assertThat(AccountManagementAction.SessionView(A_DEVICE_ID).toRustAction())
|
assertThat(AccountManagementAction.SessionView(A_DEVICE_ID).toRustAction())
|
||||||
.isEqualTo(RustAccountManagementAction.SessionView(A_DEVICE_ID.value))
|
.isEqualTo(RustAccountManagementAction.DeviceView(A_DEVICE_ID.value))
|
||||||
assertThat(AccountManagementAction.SessionsList.toRustAction())
|
assertThat(AccountManagementAction.SessionsList.toRustAction())
|
||||||
.isEqualTo(RustAccountManagementAction.SessionsList)
|
.isEqualTo(RustAccountManagementAction.DevicesList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue