mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-28 05:59:05 +03:00
Remove Robolectric, make Robolectric test an instrumentation test
This commit is contained in:
parent
ef82cc6aa7
commit
8d54a0d759
4 changed files with 5 additions and 16 deletions
|
@ -168,7 +168,6 @@ ext.libs = [
|
||||||
'kluent' : "org.amshove.kluent:kluent-android:1.68",
|
'kluent' : "org.amshove.kluent:kluent-android:1.68",
|
||||||
'timberJunitRule' : "net.lachlanmckee:timber-junit-rule:1.0.1",
|
'timberJunitRule' : "net.lachlanmckee:timber-junit-rule:1.0.1",
|
||||||
'junit' : "junit:junit:4.13.2",
|
'junit' : "junit:junit:4.13.2",
|
||||||
'robolectric' : "org.robolectric:robolectric:4.8",
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,6 @@ ext.groups = [
|
||||||
'org.ow2.asm',
|
'org.ow2.asm',
|
||||||
'org.ow2.asm',
|
'org.ow2.asm',
|
||||||
'org.reactivestreams',
|
'org.reactivestreams',
|
||||||
'org.robolectric',
|
|
||||||
'org.slf4j',
|
'org.slf4j',
|
||||||
'org.sonatype.oss',
|
'org.sonatype.oss',
|
||||||
'org.testng',
|
'org.testng',
|
||||||
|
|
|
@ -290,7 +290,6 @@ dependencies {
|
||||||
testImplementation libs.tests.kluent
|
testImplementation libs.tests.kluent
|
||||||
testImplementation libs.mockk.mockk
|
testImplementation libs.mockk.mockk
|
||||||
testImplementation libs.androidx.coreTesting
|
testImplementation libs.androidx.coreTesting
|
||||||
testImplementation libs.tests.robolectric
|
|
||||||
// Plant Timber tree for test
|
// Plant Timber tree for test
|
||||||
testImplementation libs.tests.timberJunitRule
|
testImplementation libs.tests.timberJunitRule
|
||||||
testImplementation libs.airbnb.mavericksTesting
|
testImplementation libs.airbnb.mavericksTesting
|
||||||
|
|
|
@ -16,36 +16,26 @@
|
||||||
|
|
||||||
package im.vector.app.features
|
package im.vector.app.features
|
||||||
|
|
||||||
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
|
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.test.MvRxTestRule
|
|
||||||
import im.vector.app.core.epoxy.profiles.ProfileMatrixItemWithPowerLevelWithPresence
|
import im.vector.app.core.epoxy.profiles.ProfileMatrixItemWithPowerLevelWithPresence
|
||||||
|
import im.vector.app.core.utils.waitUntil
|
||||||
import im.vector.app.features.roomprofile.members.RoomMemberListCategories
|
import im.vector.app.features.roomprofile.members.RoomMemberListCategories
|
||||||
import im.vector.app.features.roomprofile.members.RoomMemberListController
|
import im.vector.app.features.roomprofile.members.RoomMemberListController
|
||||||
import im.vector.app.features.roomprofile.members.RoomMemberListViewState
|
import im.vector.app.features.roomprofile.members.RoomMemberListViewState
|
||||||
import io.mockk.every
|
import io.mockk.every
|
||||||
import io.mockk.mockk
|
import io.mockk.mockk
|
||||||
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.amshove.kluent.shouldBeEqualTo
|
import org.amshove.kluent.shouldBeEqualTo
|
||||||
import org.junit.Rule
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
|
||||||
import org.matrix.android.sdk.api.session.crypto.model.UserVerificationLevel
|
import org.matrix.android.sdk.api.session.crypto.model.UserVerificationLevel
|
||||||
import org.matrix.android.sdk.api.session.room.model.Membership
|
import org.matrix.android.sdk.api.session.room.model.Membership
|
||||||
import org.matrix.android.sdk.api.session.room.model.RoomMemberSummary
|
import org.matrix.android.sdk.api.session.room.model.RoomMemberSummary
|
||||||
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||||
import org.robolectric.RobolectricTestRunner
|
|
||||||
|
|
||||||
@RunWith(RobolectricTestRunner::class)
|
|
||||||
class RoomMemberListControllerTest {
|
class RoomMemberListControllerTest {
|
||||||
|
|
||||||
@get:Rule
|
|
||||||
val mvrxTestRule = MvRxTestRule()
|
|
||||||
|
|
||||||
@get:Rule
|
|
||||||
val instantExecutorRule = InstantTaskExecutorRule()
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testControllerUserVerificationLevel() {
|
fun testControllerUserVerificationLevel() = runTest {
|
||||||
val roomListController = RoomMemberListController(
|
val roomListController = RoomMemberListController(
|
||||||
avatarRenderer = mockk {
|
avatarRenderer = mockk {
|
||||||
},
|
},
|
||||||
|
@ -109,6 +99,8 @@ class RoomMemberListControllerTest {
|
||||||
|
|
||||||
roomListController.setData(state)
|
roomListController.setData(state)
|
||||||
|
|
||||||
|
waitUntil { !roomListController.hasPendingModelBuild() }
|
||||||
|
|
||||||
val models = roomListController.adapter.copyOfModels
|
val models = roomListController.adapter.copyOfModels
|
||||||
|
|
||||||
val profileItems = models.filterIsInstance<ProfileMatrixItemWithPowerLevelWithPresence>()
|
val profileItems = models.filterIsInstance<ProfileMatrixItemWithPowerLevelWithPresence>()
|
Loading…
Reference in a new issue