Fix existing tests.
This commit is contained in:
parent
3e0f76a362
commit
fd9dca9621
@ -181,7 +181,7 @@ class DevicesViewModelTest {
|
|||||||
)
|
)
|
||||||
val deviceFullInfoList = listOf(deviceFullInfo1, deviceFullInfo2)
|
val deviceFullInfoList = listOf(deviceFullInfo1, deviceFullInfo2)
|
||||||
val deviceFullInfoListFlow = flowOf(deviceFullInfoList)
|
val deviceFullInfoListFlow = flowOf(deviceFullInfoList)
|
||||||
every { getDeviceFullInfoListUseCase.execute() } returns deviceFullInfoListFlow
|
every { getDeviceFullInfoListUseCase.execute(any(), any()) } returns deviceFullInfoListFlow
|
||||||
return deviceFullInfoList
|
return deviceFullInfoList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package im.vector.app.features.settings.devices.v2
|
package im.vector.app.features.settings.devices.v2
|
||||||
|
|
||||||
|
import im.vector.app.features.settings.devices.v2.filter.DeviceManagerFilterType
|
||||||
|
import im.vector.app.features.settings.devices.v2.filter.FilterDevicesUseCase
|
||||||
import im.vector.app.features.settings.devices.v2.list.CheckIfSessionIsInactiveUseCase
|
import im.vector.app.features.settings.devices.v2.list.CheckIfSessionIsInactiveUseCase
|
||||||
import im.vector.app.test.fakes.FakeActiveSessionHolder
|
import im.vector.app.test.fakes.FakeActiveSessionHolder
|
||||||
import im.vector.app.test.test
|
import im.vector.app.test.test
|
||||||
@ -47,12 +49,14 @@ class GetDeviceFullInfoListUseCaseTest {
|
|||||||
private val checkIfSessionIsInactiveUseCase = mockk<CheckIfSessionIsInactiveUseCase>()
|
private val checkIfSessionIsInactiveUseCase = mockk<CheckIfSessionIsInactiveUseCase>()
|
||||||
private val getEncryptionTrustLevelForDeviceUseCase = mockk<GetEncryptionTrustLevelForDeviceUseCase>()
|
private val getEncryptionTrustLevelForDeviceUseCase = mockk<GetEncryptionTrustLevelForDeviceUseCase>()
|
||||||
private val getCurrentSessionCrossSigningInfoUseCase = mockk<GetCurrentSessionCrossSigningInfoUseCase>()
|
private val getCurrentSessionCrossSigningInfoUseCase = mockk<GetCurrentSessionCrossSigningInfoUseCase>()
|
||||||
|
private val filterDevicesUseCase = mockk<FilterDevicesUseCase>()
|
||||||
|
|
||||||
private val getDeviceFullInfoListUseCase = GetDeviceFullInfoListUseCase(
|
private val getDeviceFullInfoListUseCase = GetDeviceFullInfoListUseCase(
|
||||||
activeSessionHolder = fakeActiveSessionHolder.instance,
|
activeSessionHolder = fakeActiveSessionHolder.instance,
|
||||||
checkIfSessionIsInactiveUseCase = checkIfSessionIsInactiveUseCase,
|
checkIfSessionIsInactiveUseCase = checkIfSessionIsInactiveUseCase,
|
||||||
getEncryptionTrustLevelForDeviceUseCase = getEncryptionTrustLevelForDeviceUseCase,
|
getEncryptionTrustLevelForDeviceUseCase = getEncryptionTrustLevelForDeviceUseCase,
|
||||||
getCurrentSessionCrossSigningInfoUseCase = getCurrentSessionCrossSigningInfoUseCase,
|
getCurrentSessionCrossSigningInfoUseCase = getCurrentSessionCrossSigningInfoUseCase,
|
||||||
|
filterDevicesUseCase = filterDevicesUseCase,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@ -117,9 +121,10 @@ class GetDeviceFullInfoListUseCaseTest {
|
|||||||
isInactive = false
|
isInactive = false
|
||||||
)
|
)
|
||||||
val expectedResult = listOf(expectedResult3, expectedResult2, expectedResult1)
|
val expectedResult = listOf(expectedResult3, expectedResult2, expectedResult1)
|
||||||
|
every { filterDevicesUseCase.execute(any(), any()) } returns expectedResult
|
||||||
|
|
||||||
// When
|
// When
|
||||||
val result = getDeviceFullInfoListUseCase.execute()
|
val result = getDeviceFullInfoListUseCase.execute(DeviceManagerFilterType.ALL_SESSIONS, excludeCurrentDevice = false)
|
||||||
.test(this)
|
.test(this)
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
@ -144,7 +149,7 @@ class GetDeviceFullInfoListUseCaseTest {
|
|||||||
fakeActiveSessionHolder.givenGetSafeActiveSessionReturns(null)
|
fakeActiveSessionHolder.givenGetSafeActiveSessionReturns(null)
|
||||||
|
|
||||||
// When
|
// When
|
||||||
val result = getDeviceFullInfoListUseCase.execute()
|
val result = getDeviceFullInfoListUseCase.execute(DeviceManagerFilterType.ALL_SESSIONS, excludeCurrentDevice = false)
|
||||||
.test(this)
|
.test(this)
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
|
Loading…
Reference in New Issue
Block a user