Code review

This commit is contained in:
valere 2023-05-31 12:18:27 +02:00
parent dc969f502a
commit 8c1938987b
3 changed files with 5 additions and 5 deletions

View file

@ -147,7 +147,7 @@ class SelfVerificationViewModel @AssistedInject constructor(
} }
setState { copy(hasAnyOtherSession = Loading()) } setState { copy(hasAnyOtherSession = Loading()) }
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch {
val hasAnyOtherSession = session.cryptoService() val hasAnyOtherSession = session.cryptoService()
.getCryptoDeviceInfo(session.myUserId) .getCryptoDeviceInfo(session.myUserId)
.any { .any {

View file

@ -19,7 +19,7 @@ package im.vector.app.core.device
import im.vector.app.test.fakes.FakeActiveSessionHolder import im.vector.app.test.fakes.FakeActiveSessionHolder
import im.vector.app.test.fakes.FakeCryptoService import im.vector.app.test.fakes.FakeCryptoService
import im.vector.app.test.fakes.FakeSession import im.vector.app.test.fakes.FakeSession
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.runTest
import org.amshove.kluent.shouldBeEqualTo import org.amshove.kluent.shouldBeEqualTo
import org.junit.Test import org.junit.Test
@ -33,7 +33,7 @@ class DefaultGetDeviceInfoUseCaseTest {
@Test @Test
fun `when execute, then get crypto device info`() { fun `when execute, then get crypto device info`() {
val result = runBlocking { getDeviceInfoUseCase.execute() } val result = runTest { getDeviceInfoUseCase.execute() }
result shouldBeEqualTo cryptoService.cryptoDeviceInfo result shouldBeEqualTo cryptoService.cryptoDeviceInfo
} }

View file

@ -29,7 +29,7 @@ import im.vector.app.test.fixtures.CryptoDeviceInfoFixture.aCryptoDeviceInfo
import im.vector.app.test.fixtures.PusherFixture import im.vector.app.test.fixtures.PusherFixture
import im.vector.app.test.fixtures.SessionParamsFixture import im.vector.app.test.fixtures.SessionParamsFixture
import io.mockk.mockk import io.mockk.mockk
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.runTest
import org.amshove.kluent.shouldBeEqualTo import org.amshove.kluent.shouldBeEqualTo
import org.junit.Test import org.junit.Test
import org.matrix.android.sdk.api.session.crypto.model.UnsignedDeviceInfo import org.matrix.android.sdk.api.session.crypto.model.UnsignedDeviceInfo
@ -81,7 +81,7 @@ class PushersManagerTest {
withEventIdOnly = true, withEventIdOnly = true,
) )
runBlocking { runTest {
pushersManager.enqueueRegisterPusher(pushKey, gateway) pushersManager.enqueueRegisterPusher(pushKey, gateway)
} }