From 06d447247abc296d368983c627400c7e9d8ba09c Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Mon, 5 Sep 2022 17:26:43 +0200 Subject: [PATCH] Updating existing unit tests --- .../devices/v2/overview/GetDeviceFullInfoUseCase.kt | 1 - .../v2/overview/GetDeviceFullInfoUseCaseTest.kt | 11 ++++++----- .../v2/overview/SessionOverviewViewModelTest.kt | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/v2/overview/GetDeviceFullInfoUseCase.kt b/vector/src/main/java/im/vector/app/features/settings/devices/v2/overview/GetDeviceFullInfoUseCase.kt index 60c6266901..fff81b6dc5 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/v2/overview/GetDeviceFullInfoUseCase.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/v2/overview/GetDeviceFullInfoUseCase.kt @@ -29,7 +29,6 @@ import org.matrix.android.sdk.api.util.Optional import org.matrix.android.sdk.api.util.toOptional import javax.inject.Inject -// TODO update unit tests class GetDeviceFullInfoUseCase @Inject constructor( private val activeSessionHolder: ActiveSessionHolder, private val getCurrentSessionCrossSigningInfoUseCase: GetCurrentSessionCrossSigningInfoUseCase, diff --git a/vector/src/test/java/im/vector/app/features/settings/devices/v2/overview/GetDeviceFullInfoUseCaseTest.kt b/vector/src/test/java/im/vector/app/features/settings/devices/v2/overview/GetDeviceFullInfoUseCaseTest.kt index 70af681c6f..7dc8e08a4e 100644 --- a/vector/src/test/java/im/vector/app/features/settings/devices/v2/overview/GetDeviceFullInfoUseCaseTest.kt +++ b/vector/src/test/java/im/vector/app/features/settings/devices/v2/overview/GetDeviceFullInfoUseCaseTest.kt @@ -19,9 +19,9 @@ package im.vector.app.features.settings.devices.v2.overview import androidx.lifecycle.MutableLiveData import androidx.lifecycle.asFlow import im.vector.app.features.settings.devices.v2.CurrentSessionCrossSigningInfo -import im.vector.app.features.settings.devices.DeviceFullInfo -import im.vector.app.features.settings.devices.GetCurrentSessionCrossSigningInfoUseCase -import im.vector.app.features.settings.devices.GetEncryptionTrustLevelForDeviceUseCase +import im.vector.app.features.settings.devices.v2.DeviceFullInfo +import im.vector.app.features.settings.devices.v2.GetCurrentSessionCrossSigningInfoUseCase +import im.vector.app.features.settings.devices.v2.GetEncryptionTrustLevelForDeviceUseCase import im.vector.app.features.settings.devices.v2.list.CheckIfSessionIsInactiveUseCase import im.vector.app.test.fakes.FakeActiveSessionHolder import im.vector.app.test.fakes.FakeFlowLiveDataConversions @@ -31,6 +31,7 @@ import io.mockk.mockk import io.mockk.unmockkAll import io.mockk.verify import kotlinx.coroutines.flow.firstOrNull +import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runTest import org.amshove.kluent.shouldBeEqualTo import org.junit.After @@ -90,7 +91,7 @@ class GetDeviceFullInfoUseCaseTest { DeviceFullInfo( deviceInfo = deviceInfo, cryptoDeviceInfo = cryptoDeviceInfo, - trustLevelForShield = trustLevel, + roomEncryptionTrustLevel = trustLevel, isInactive = isInactive, ) ) @@ -134,7 +135,7 @@ class GetDeviceFullInfoUseCaseTest { isCrossSigningInitialized = true, isCrossSigningVerified = false ) - every { getCurrentSessionCrossSigningInfoUseCase.execute() } returns currentSessionCrossSigningInfo + every { getCurrentSessionCrossSigningInfoUseCase.execute() } returns flowOf(currentSessionCrossSigningInfo) return currentSessionCrossSigningInfo } diff --git a/vector/src/test/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewViewModelTest.kt b/vector/src/test/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewViewModelTest.kt index 735c553808..4a26fc4adc 100644 --- a/vector/src/test/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewViewModelTest.kt +++ b/vector/src/test/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewViewModelTest.kt @@ -18,7 +18,7 @@ package im.vector.app.features.settings.devices.v2.overview import com.airbnb.mvrx.Success import com.airbnb.mvrx.test.MvRxTestRule -import im.vector.app.features.settings.devices.DeviceFullInfo +import im.vector.app.features.settings.devices.v2.DeviceFullInfo import im.vector.app.test.fakes.FakeSession import im.vector.app.test.test import io.mockk.every