diff --git a/vector/src/main/java/im/vector/app/core/di/MavericksViewModelModule.kt b/vector/src/main/java/im/vector/app/core/di/MavericksViewModelModule.kt index 10aee61ae5..6fb2505386 100644 --- a/vector/src/main/java/im/vector/app/core/di/MavericksViewModelModule.kt +++ b/vector/src/main/java/im/vector/app/core/di/MavericksViewModelModule.kt @@ -88,8 +88,8 @@ import im.vector.app.features.settings.account.deactivation.DeactivateAccountVie import im.vector.app.features.settings.crosssigning.CrossSigningSettingsViewModel import im.vector.app.features.settings.devices.DeviceVerificationInfoBottomSheetViewModel import im.vector.app.features.settings.devices.DevicesViewModel -import im.vector.app.features.settings.devices.v2.othersessions.OtherSessionsViewModel import im.vector.app.features.settings.devices.v2.details.SessionDetailsViewModel +import im.vector.app.features.settings.devices.v2.othersessions.OtherSessionsViewModel import im.vector.app.features.settings.devices.v2.overview.SessionOverviewViewModel import im.vector.app.features.settings.devtools.AccountDataViewModel import im.vector.app.features.settings.devtools.GossipingEventsPaperTrailViewModel diff --git a/vector/src/test/java/im/vector/app/features/settings/devices/v2/DevicesViewModelTest.kt b/vector/src/test/java/im/vector/app/features/settings/devices/v2/DevicesViewModelTest.kt index ebcfee324c..351d6b8eb0 100644 --- a/vector/src/test/java/im/vector/app/features/settings/devices/v2/DevicesViewModelTest.kt +++ b/vector/src/test/java/im/vector/app/features/settings/devices/v2/DevicesViewModelTest.kt @@ -52,8 +52,8 @@ class DevicesViewModelTest { fakeActiveSessionHolder.instance, getCurrentSessionCrossSigningInfoUseCase, getDeviceFullInfoListUseCase, - refreshDevicesUseCase, refreshDevicesOnCryptoDevicesChangeUseCase, + refreshDevicesUseCase, ) } diff --git a/vector/src/test/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsViewNavigatorTest.kt b/vector/src/test/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsViewNavigatorTest.kt new file mode 100644 index 0000000000..3123572521 --- /dev/null +++ b/vector/src/test/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsViewNavigatorTest.kt @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2022 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.features.settings.devices.v2.othersessions + +import android.content.Intent +import im.vector.app.features.settings.devices.v2.overview.SessionOverviewActivity +import im.vector.app.test.fakes.FakeContext +import io.mockk.every +import io.mockk.mockk +import io.mockk.mockkObject +import io.mockk.unmockkAll +import io.mockk.verify +import org.junit.After +import org.junit.Before +import org.junit.Test + +private const val A_DEVICE_ID = "A_DEVICE_ID" + +class OtherSessionsViewNavigatorTest { + + private val context = FakeContext() + private val otherSessionsViewNavigator = OtherSessionsViewNavigator() + + @Before + fun setUp() { + mockkObject(SessionOverviewActivity) + } + + @After + fun tearDown() { + unmockkAll() + } + + @Test + fun `given a device id when navigating to overview then it starts the correct activity`() { + val intent = givenIntentForDeviceOverview(A_DEVICE_ID) + context.givenStartActivity(intent) + + otherSessionsViewNavigator.navigateToSessionOverview(context.instance, A_DEVICE_ID) + + verify { + context.instance.startActivity(intent) + } + } + + private fun givenIntentForDeviceOverview(deviceId: String): Intent { + val intent = mockk() + every { SessionOverviewActivity.newIntent(context.instance, deviceId) } returns intent + return intent + } +}