mirror of
https://github.com/element-hq/element-android
synced 2024-11-23 18:05:36 +03:00
fix unit test
This commit is contained in:
parent
cd101f871c
commit
5f68f98d3a
4 changed files with 11 additions and 4 deletions
|
@ -35,7 +35,7 @@ class RefreshDevicesUseCaseTest {
|
|||
fun `given current session when refreshing then devices list and keys are fetched`() {
|
||||
val session = fakeActiveSessionHolder.fakeSession
|
||||
coEvery { session.cryptoService().fetchDevicesList() } returns emptyList()
|
||||
coEvery { session.cryptoService().downloadKeysIfNeeded(any()) } returns MXUsersDevicesMap()
|
||||
coEvery { session.cryptoService().downloadKeysIfNeeded(any(), any()) } returns MXUsersDevicesMap()
|
||||
|
||||
runBlocking {
|
||||
refreshDevicesUseCase.execute()
|
||||
|
|
|
@ -46,6 +46,7 @@ import org.junit.Before
|
|||
import org.junit.Ignore
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.matrix.android.sdk.api.session.homeserver.HomeServerCapabilities
|
||||
import org.matrix.android.sdk.api.session.uia.DefaultBaseAuth
|
||||
|
||||
private const val A_DEVICE_ID_1 = "device-id-1"
|
||||
|
@ -87,8 +88,10 @@ class OtherSessionsViewModelTest {
|
|||
// Needed for internal usage of Flow<T>.throttleFirst() inside the ViewModel
|
||||
mockkStatic(SystemClock::class)
|
||||
every { SystemClock.elapsedRealtime() } returns 1234
|
||||
|
||||
givenVerificationService()
|
||||
fakeActiveSessionHolder.fakeSession.fakeHomeServerCapabilitiesService.givenCapabilities(
|
||||
HomeServerCapabilities()
|
||||
)
|
||||
givenVerificationService().givenEventFlow()
|
||||
fakeVectorPreferences.givenSessionManagerShowIpAddress(false)
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ import org.junit.Ignore
|
|||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.matrix.android.sdk.api.session.crypto.model.RoomEncryptionTrustLevel
|
||||
import org.matrix.android.sdk.api.session.homeserver.HomeServerCapabilities
|
||||
import org.matrix.android.sdk.api.session.uia.DefaultBaseAuth
|
||||
|
||||
private const val A_SESSION_ID_1 = "session-id-1"
|
||||
|
@ -101,6 +102,9 @@ class SessionOverviewViewModelTest {
|
|||
mockkStatic(SystemClock::class)
|
||||
every { SystemClock.elapsedRealtime() } returns 1234
|
||||
|
||||
fakeActiveSessionHolder.fakeSession.fakeHomeServerCapabilitiesService.givenCapabilities(
|
||||
HomeServerCapabilities()
|
||||
)
|
||||
givenVerificationService()
|
||||
fakeGetNotificationsStatusUseCase.givenExecuteReturns(
|
||||
fakeActiveSessionHolder.fakeSession,
|
||||
|
|
|
@ -43,7 +43,7 @@ class RenameSessionUseCaseTest {
|
|||
fun `given a device id and a new name when no error during rename then the device is renamed with success`() = runTest {
|
||||
// Given
|
||||
fakeActiveSessionHolder.fakeSession.fakeCryptoService.givenSetDeviceNameSucceeds()
|
||||
coVerify { refreshDevicesUseCase.execute() }
|
||||
coEvery { refreshDevicesUseCase.execute() } returns Unit
|
||||
|
||||
// When
|
||||
val result = renameSessionUseCase.execute(A_DEVICE_ID, A_DEVICE_NAME)
|
||||
|
|
Loading…
Reference in a new issue