Replace deprecated MvRxTestRule with MavericksTestRule

This commit is contained in:
Florian Renaud 2022-10-05 14:48:59 +02:00
parent 8c35a8cf6b
commit 010f2c458c
12 changed files with 24 additions and 24 deletions

View File

@ -314,7 +314,7 @@ class ViewModelTest {
private var initialState = ViewState.Empty
@get:Rule
val mvrxTestRule = MvRxTestRule(testDispatcher = UnconfinedTestDispatcher())
val mavericksTestRule = MavericksTestRule(testDispatcher = UnconfinedTestDispatcher())
@Test
fun `when handling MyAction, then emits Loading and Content states`() {

View File

@ -18,7 +18,7 @@ package im.vector.app.features
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.lifecycle.MutableLiveData
import com.airbnb.mvrx.test.MvRxTestRule
import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.features.roomprofile.RoomProfileArgs
import im.vector.app.features.roomprofile.members.RoomMemberListViewModel
import im.vector.app.features.roomprofile.members.RoomMemberListViewState
@ -52,7 +52,7 @@ import org.matrix.android.sdk.api.util.Optional
class MemberListViewModelTest {
@get:Rule
val mvrxTestRule = MvRxTestRule()
val mavericksTestRule = MavericksTestRule()
@get:Rule
val instantExecutorRule = InstantTaskExecutorRule()

View File

@ -17,7 +17,7 @@
package im.vector.app.features.crypto.quads
import com.airbnb.mvrx.Uninitialized
import com.airbnb.mvrx.test.MvRxTestRule
import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.test.fakes.FakeSession
import im.vector.app.test.fakes.FakeStringProvider
import im.vector.app.test.test
@ -42,7 +42,7 @@ private val KEY_INFO_WITHOUT_PASSPHRASE = KeyInfo(id = "id", content = SecretSto
class SharedSecureStorageViewModelTest {
@get:Rule
val mvrxTestRule = MvRxTestRule()
val mavericksTestRule = MavericksTestRule()
private val stringProvider = FakeStringProvider()
private val fakeSession = FakeSession()

View File

@ -16,7 +16,7 @@
package im.vector.app.features.location.live.map
import com.airbnb.mvrx.test.MvRxTestRule
import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.features.location.LocationData
import im.vector.app.features.location.live.StopLiveLocationShareUseCase
import im.vector.app.test.fakes.FakeLocationSharingServiceConnection
@ -37,7 +37,7 @@ private const val A_ROOM_ID = "room_id"
class LiveLocationMapViewModelTest {
@get:Rule
val mvRxTestRule = MvRxTestRule(testDispatcher = UnconfinedTestDispatcher())
val mavericksTestRule = MavericksTestRule(testDispatcher = UnconfinedTestDispatcher())
private val args = LiveLocationMapViewArgs(roomId = A_ROOM_ID)

View File

@ -18,7 +18,7 @@ package im.vector.app.features.onboarding
import android.net.Uri
import android.os.Build
import com.airbnb.mvrx.test.MvRxTestRule
import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.R
import im.vector.app.features.login.LoginConfig
import im.vector.app.features.login.LoginMode
@ -96,7 +96,7 @@ private val SSO_REGISTRATION_DESCRIPTION = AuthenticationDescription.Register(Au
class OnboardingViewModelTest {
@get:Rule
val mvrxTestRule = MvRxTestRule()
val mavericksTestRule = MavericksTestRule()
private val fakeUri = FakeUri()
private val fakeContext = FakeContext()

View File

@ -21,7 +21,7 @@ import android.os.Build
import android.security.keystore.KeyPermanentlyInvalidatedException
import androidx.biometric.BiometricPrompt
import androidx.fragment.app.FragmentActivity
import com.airbnb.mvrx.test.MvRxTestRule
import com.airbnb.mvrx.test.MavericksTestRule
import com.airbnb.mvrx.withState
import im.vector.app.features.pin.lockscreen.biometrics.BiometricAuthError
import im.vector.app.features.pin.lockscreen.biometrics.BiometricHelper
@ -54,7 +54,7 @@ import org.junit.Test
class LockScreenViewModelTests {
@get:Rule
val mvrxTestRule = MvRxTestRule()
val mavericksTestRule = MavericksTestRule()
private val pinCodeHelper = mockk<PinCodeHelper>(relaxed = true)
private val biometricHelper = mockk<BiometricHelper>(relaxed = true)
@ -295,7 +295,7 @@ class LockScreenViewModelTests {
test.assertEvents(LockScreenViewEvent.ShowBiometricKeyInvalidatedMessage)
}
private fun createViewState(
private fun createViewState(
lockScreenConfiguration: LockScreenConfiguration = createDefaultConfiguration(),
canUseBiometricAuth: Boolean = false,
showBiometricPromptAutomatically: Boolean = false,

View File

@ -16,7 +16,7 @@
package im.vector.app.features.poll.create
import com.airbnb.mvrx.test.MvRxTestRule
import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.features.poll.PollMode
import im.vector.app.test.fakes.FakeCreatePollViewStates.A_FAKE_OPTIONS
import im.vector.app.test.fakes.FakeCreatePollViewStates.A_FAKE_QUESTION
@ -48,7 +48,7 @@ class CreatePollViewModelTest {
private val testDispatcher = UnconfinedTestDispatcher()
@get:Rule
val mvRxTestRule = MvRxTestRule(
val mavericksTestRule = MavericksTestRule(
testDispatcher = testDispatcher // See https://github.com/airbnb/mavericks/issues/599
)

View File

@ -18,7 +18,7 @@ package im.vector.app.features.settings.devices.v2
import android.os.SystemClock
import com.airbnb.mvrx.Success
import com.airbnb.mvrx.test.MvRxTestRule
import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.features.settings.devices.v2.list.DeviceType
import im.vector.app.features.settings.devices.v2.verification.CheckIfCurrentSessionCanBeVerifiedUseCase
import im.vector.app.features.settings.devices.v2.verification.CurrentSessionCrossSigningInfo
@ -48,7 +48,7 @@ import org.matrix.android.sdk.api.session.crypto.model.RoomEncryptionTrustLevel
class DevicesViewModelTest {
@get:Rule
val mvRxTestRule = MvRxTestRule(testDispatcher = testDispatcher)
val mavericksTestRule = MavericksTestRule(testDispatcher = testDispatcher)
private val fakeActiveSessionHolder = FakeActiveSessionHolder()
private val getCurrentSessionCrossSigningInfoUseCase = mockk<GetCurrentSessionCrossSigningInfoUseCase>()

View File

@ -17,7 +17,7 @@
package im.vector.app.features.settings.devices.v2.details
import com.airbnb.mvrx.Success
import com.airbnb.mvrx.test.MvRxTestRule
import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.core.utils.CopyToClipboardUseCase
import im.vector.app.features.settings.devices.v2.DeviceFullInfo
import im.vector.app.features.settings.devices.v2.overview.GetDeviceFullInfoUseCase
@ -39,7 +39,7 @@ private const val A_TEXT = "text"
class SessionDetailsViewModelTest {
@get:Rule
val mvRxTestRule = MvRxTestRule(testDispatcher = testDispatcher)
val mavericksTestRule = MavericksTestRule(testDispatcher = testDispatcher)
private val args = SessionDetailsArgs(
deviceId = A_SESSION_ID

View File

@ -18,7 +18,7 @@ package im.vector.app.features.settings.devices.v2.overview
import android.os.SystemClock
import com.airbnb.mvrx.Success
import com.airbnb.mvrx.test.MvRxTestRule
import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.R
import im.vector.app.features.settings.devices.v2.DeviceFullInfo
import im.vector.app.features.settings.devices.v2.RefreshDevicesUseCase
@ -67,7 +67,7 @@ private const val A_PASSWORD = "password"
class SessionOverviewViewModelTest {
@get:Rule
val mvRxTestRule = MvRxTestRule(testDispatcher = testDispatcher)
val mavericksTestRule = MavericksTestRule(testDispatcher = testDispatcher)
private val args = SessionOverviewArgs(
deviceId = A_SESSION_ID_1

View File

@ -16,7 +16,7 @@
package im.vector.app.features.settings.devices.v2.rename
import com.airbnb.mvrx.test.MvRxTestRule
import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.features.settings.devices.v2.DeviceFullInfo
import im.vector.app.features.settings.devices.v2.overview.GetDeviceFullInfoUseCase
import im.vector.app.test.test
@ -36,7 +36,7 @@ private const val AN_EDITED_SESSION_NAME = "edited-session-name"
class RenameSessionViewModelTest {
@get:Rule
val mvRxTestRule = MvRxTestRule(testDispatcher = testDispatcher)
val mavericksTestRule = MavericksTestRule(testDispatcher = testDispatcher)
private val args = RenameSessionArgs(
deviceId = A_SESSION_ID

View File

@ -16,7 +16,7 @@
package im.vector.app.features.settings.font
import com.airbnb.mvrx.test.MvRxTestRule
import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.features.settings.FontScaleValue
import im.vector.app.test.fakes.FakeConfiguration
import im.vector.app.test.fakes.FakeFontScalePreferences
@ -38,7 +38,7 @@ private fun aFontScaleValue(index: Int) = FontScaleValue(index, "foo", -1f, 0)
class FontScaleSettingViewModelTest {
@get:Rule
val mvrxTestRule = MvRxTestRule()
val mavericksTestRule = MavericksTestRule()
private val fakeConfiguration = FakeConfiguration()
private val fakeFontScalePreferences = FakeFontScalePreferences()