Merge pull request #6576 from element-hq/renovate/com.google.testparameterinjector-test-parameter-injector-1.x

Update dependency com.google.testparameterinjector:test-parameter-injector to v1.22
This commit is contained in:
Benoit Marty 2026-04-15 09:45:56 +02:00 committed by GitHub
commit b6188a7646
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 46 deletions

View file

@ -13,7 +13,8 @@ import androidx.compose.ui.test.junit4.AndroidComposeTestRule
import androidx.compose.ui.test.junit4.createAndroidComposeRule import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick import androidx.compose.ui.test.performClick
import androidx.test.ext.junit.runners.AndroidJUnit4 import com.google.testing.junit.testparameterinjector.KotlinTestParameters.namedTestValues
import com.google.testing.junit.testparameterinjector.TestParameter
import io.element.android.features.login.impl.R import io.element.android.features.login.impl.R
import io.element.android.features.login.impl.login.LoginMode import io.element.android.features.login.impl.login.LoginMode
import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.architecture.AsyncData
@ -31,8 +32,9 @@ import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.junit.rules.TestRule import org.junit.rules.TestRule
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.robolectric.RobolectricTestParameterInjector
@RunWith(AndroidJUnit4::class) @RunWith(RobolectricTestParameterInjector::class)
class OnboardingViewTest { class OnboardingViewTest {
@get:Rule @get:Rule
val rule = createAndroidComposeRule<ComponentActivity>() val rule = createAndroidComposeRule<ComponentActivity>()
@ -83,21 +85,11 @@ class OnboardingViewTest {
} }
@Test @Test
fun `when can login with QR code - clicking on sign in manually calls the expected callback - can search account provider`() { fun `when can login with QR code - clicking on sign in manually calls the expected callback`(
`when can login with QR code - clicking on sign in manually calls the expected callback`( @TestParameter mustChooseAccountProvider: Boolean = namedTestValues(
mustChooseAccountProvider = false, "can search account provider" to false,
"cannot search account provider" to true,
) )
}
@Test
fun `when can login with QR code - clicking on sign in manually calls the expected callback - cannot search account provider`() {
`when can login with QR code - clicking on sign in manually calls the expected callback`(
mustChooseAccountProvider = true,
)
}
private fun `when can login with QR code - clicking on sign in manually calls the expected callback`(
mustChooseAccountProvider: Boolean,
) { ) {
val eventSink = EventsRecorder<OnBoardingEvents>(expectEvents = false) val eventSink = EventsRecorder<OnBoardingEvents>(expectEvents = false)
ensureCalledOnceWithParam(mustChooseAccountProvider) { callback -> ensureCalledOnceWithParam(mustChooseAccountProvider) { callback ->
@ -114,21 +106,11 @@ class OnboardingViewTest {
} }
@Test @Test
fun `when cannot login with QR code or create account - clicking on continue calls the sign in callback - can search account provider`() { fun `when cannot login with QR code or create account - clicking on continue calls the sign in callback`(
`when cannot login with QR code or create account - clicking on continue calls the sign in callback`( @TestParameter mustChooseAccountProvider: Boolean = namedTestValues(
mustChooseAccountProvider = false, "can search account provider" to false,
"cannot search account provider" to true,
) )
}
@Test
fun `when cannot login with QR code or create account - clicking on continue calls the sign in callback - cannot search account provider`() {
`when cannot login with QR code or create account - clicking on continue calls the sign in callback`(
mustChooseAccountProvider = true,
)
}
private fun `when cannot login with QR code or create account - clicking on continue calls the sign in callback`(
mustChooseAccountProvider: Boolean,
) { ) {
val eventSink = EventsRecorder<OnBoardingEvents>(expectEvents = false) val eventSink = EventsRecorder<OnBoardingEvents>(expectEvents = false)
ensureCalledOnceWithParam(mustChooseAccountProvider) { callback -> ensureCalledOnceWithParam(mustChooseAccountProvider) { callback ->

View file

@ -11,6 +11,9 @@
package io.element.android.features.space.impl.root package io.element.android.features.space.impl.root
import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertThat
import com.google.testing.junit.testparameterinjector.KotlinTestParameters.namedTestValues
import com.google.testing.junit.testparameterinjector.TestParameter
import com.google.testing.junit.testparameterinjector.TestParameterInjector
import io.element.android.features.invite.api.SeenInvitesStore import io.element.android.features.invite.api.SeenInvitesStore
import io.element.android.features.invite.api.acceptdecline.AcceptDeclineInviteEvents import io.element.android.features.invite.api.acceptdecline.AcceptDeclineInviteEvents
import io.element.android.features.invite.api.acceptdecline.AcceptDeclineInviteState import io.element.android.features.invite.api.acceptdecline.AcceptDeclineInviteState
@ -49,8 +52,10 @@ import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import im.vector.app.features.analytics.plan.JoinedRoom as AnalyticsJoinedRoom import im.vector.app.features.analytics.plan.JoinedRoom as AnalyticsJoinedRoom
@RunWith(TestParameterInjector::class)
class SpacePresenterTest { class SpacePresenterTest {
@Test @Test
fun `present - initial state`() = runTest { fun `present - initial state`() = runTest {
@ -259,21 +264,11 @@ class SpacePresenterTest {
} }
@Test @Test
fun `present - accept invite is transmitted to acceptDeclineInviteState`() { fun `present - invite action is transmitted to acceptDeclineInviteState`(
`invite action is transmitted to acceptDeclineInviteState`( @TestParameter acceptInvite: Boolean = namedTestValues(
acceptInvite = true, "accept" to true,
) "decline" to false,
} ),
@Test
fun `present - decline invite is transmitted to acceptDeclineInviteState`() {
`invite action is transmitted to acceptDeclineInviteState`(
acceptInvite = false,
)
}
private fun `invite action is transmitted to acceptDeclineInviteState`(
acceptInvite: Boolean,
) = runTest { ) = runTest {
val eventRecorder = EventsRecorder<AcceptDeclineInviteEvents>() val eventRecorder = EventsRecorder<AcceptDeclineInviteEvents>()
val anInvitedRoom = aSpaceRoom( val anInvitedRoom = aSpaceRoom(

View file

@ -165,7 +165,7 @@ test_mockk = "io.mockk:mockk:1.14.9"
test_konsist = "com.lemonappdev:konsist:0.17.3" test_konsist = "com.lemonappdev:konsist:0.17.3"
test_turbine = "app.cash.turbine:turbine:1.2.1" test_turbine = "app.cash.turbine:turbine:1.2.1"
test_truth = "com.google.truth:truth:1.4.5" test_truth = "com.google.truth:truth:1.4.5"
test_parameter_injector = "com.google.testparameterinjector:test-parameter-injector:1.21" test_parameter_injector = "com.google.testparameterinjector:test-parameter-injector:1.22"
test_robolectric = "org.robolectric:robolectric:4.16.1" test_robolectric = "org.robolectric:robolectric:4.16.1"
test_appyx_junit = { module = "com.bumble.appyx:testing-junit4", version.ref = "appyx" } test_appyx_junit = { module = "com.bumble.appyx:testing-junit4", version.ref = "appyx" }
test_composable_preview_scanner = "io.github.sergio-sastre.ComposablePreviewScanner:android:0.8.2" test_composable_preview_scanner = "io.github.sergio-sastre.ComposablePreviewScanner:android:0.8.2"

View file

@ -49,6 +49,7 @@ fun DependencyHandlerScope.testCommonDependencies(
testImplementation(libs.test.arch.core) testImplementation(libs.test.arch.core)
testImplementation(libs.test.junit) testImplementation(libs.test.junit)
testImplementation(libs.test.mockk) testImplementation(libs.test.mockk)
testImplementation(libs.test.parameter.injector)
testImplementation(libs.test.robolectric) testImplementation(libs.test.robolectric)
testImplementation(libs.test.truth) testImplementation(libs.test.truth)
testImplementation(libs.test.turbine) testImplementation(libs.test.turbine)