Avoid using AndroidJUnit4 runner to test Entrypoint implementations.
This commit is contained in:
parent
c90332bb6e
commit
4d7d0ac8d0
39 changed files with 271 additions and 119 deletions
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright 2025 New Vector Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.features.lockscreen.impl
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import io.element.android.features.lockscreen.impl.unlock.activity.PinUnlockActivity
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class DefaultLockScreenEntryPointIntentTest {
|
||||
@Test
|
||||
fun `test pin unlock intent`() {
|
||||
val entryPoint = DefaultLockScreenEntryPoint()
|
||||
val result = entryPoint.pinUnlockIntent(InstrumentationRegistry.getInstrumentation().context)
|
||||
assertThat(result.component?.className).isEqualTo(PinUnlockActivity::class.qualifiedName)
|
||||
}
|
||||
}
|
||||
|
|
@ -7,19 +7,23 @@
|
|||
|
||||
package io.element.android.features.lockscreen.impl
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
|
||||
import com.bumble.appyx.core.modality.BuildContext
|
||||
import com.bumble.appyx.testing.junit4.util.MainDispatcherRule
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import io.element.android.features.lockscreen.api.LockScreenEntryPoint
|
||||
import io.element.android.features.lockscreen.impl.unlock.activity.PinUnlockActivity
|
||||
import io.element.android.tests.testutils.lambda.lambdaError
|
||||
import io.element.android.tests.testutils.node.TestParentNode
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class DefaultLockScreenEntryPointTest {
|
||||
@get:Rule
|
||||
val instantTaskExecutorRule = InstantTaskExecutorRule()
|
||||
|
||||
@get:Rule
|
||||
val mainDispatcherRule = MainDispatcherRule()
|
||||
|
||||
@Test
|
||||
fun `test node builder Setup`() {
|
||||
val entryPoint = DefaultLockScreenEntryPoint()
|
||||
|
|
@ -61,11 +65,4 @@ class DefaultLockScreenEntryPointTest {
|
|||
assertThat(result.plugins).contains(LockScreenFlowNode.Inputs(LockScreenFlowNode.NavTarget.Settings))
|
||||
assertThat(result.plugins).contains(callback)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test pin unlock intent`() {
|
||||
val entryPoint = DefaultLockScreenEntryPoint()
|
||||
val result = entryPoint.pinUnlockIntent(InstrumentationRegistry.getInstrumentation().context)
|
||||
assertThat(result.component?.className).isEqualTo(PinUnlockActivity::class.qualifiedName)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue