mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Move NotUsedPresenter to the testutils module
The fake presenter was declared in RootFlowNodeTest, so other tests could not use it. Move it to the testutils module, in a new presenter package, along with MutablePresenter. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -43,7 +43,6 @@ import io.element.android.features.signedout.test.FakeSignedOutEntryPoint
|
|||||||
import io.element.android.libraries.accountselect.test.FakeAccountSelectEntryPoint
|
import io.element.android.libraries.accountselect.test.FakeAccountSelectEntryPoint
|
||||||
import io.element.android.libraries.architecture.AssistedNodeFactory
|
import io.element.android.libraries.architecture.AssistedNodeFactory
|
||||||
import io.element.android.libraries.architecture.NodeFactoriesBindings
|
import io.element.android.libraries.architecture.NodeFactoriesBindings
|
||||||
import io.element.android.libraries.architecture.Presenter
|
|
||||||
import io.element.android.libraries.di.DependencyInjectionGraphOwner
|
import io.element.android.libraries.di.DependencyInjectionGraphOwner
|
||||||
import io.element.android.libraries.featureflag.test.FakeFeatureFlagService
|
import io.element.android.libraries.featureflag.test.FakeFeatureFlagService
|
||||||
import io.element.android.libraries.matrix.test.FakeSdkMetadata
|
import io.element.android.libraries.matrix.test.FakeSdkMetadata
|
||||||
@@ -58,6 +57,7 @@ import io.element.android.libraries.sessionstorage.test.InMemorySessionStore
|
|||||||
import io.element.android.services.analytics.test.FakeAnalyticsService
|
import io.element.android.services.analytics.test.FakeAnalyticsService
|
||||||
import io.element.android.services.analytics.test.watchers.FakeAnalyticsColdStartWatcher
|
import io.element.android.services.analytics.test.watchers.FakeAnalyticsColdStartWatcher
|
||||||
import io.element.android.services.apperror.test.FakeAppErrorStateService
|
import io.element.android.services.apperror.test.FakeAppErrorStateService
|
||||||
|
import io.element.android.tests.testutils.presenter.NotUsedPresenter
|
||||||
import io.element.android.tests.testutils.robolectric.RobolectricTest
|
import io.element.android.tests.testutils.robolectric.RobolectricTest
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.test.TestScope
|
import kotlinx.coroutines.test.TestScope
|
||||||
@@ -194,14 +194,6 @@ private val A_LOGIN_ENTRY_POINT_PARAMS = LoginEntryPoint.Params(
|
|||||||
loginHint = A_LOGIN_PARAMS.loginHint,
|
loginHint = A_LOGIN_PARAMS.loginHint,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
|
||||||
* The presenters are only used when the [Node] is rendered, which does not happen in these tests.
|
|
||||||
*/
|
|
||||||
private class NotUsedPresenter<T> : Presenter<T> {
|
|
||||||
@Composable
|
|
||||||
override fun present(): T = error("Not used")
|
|
||||||
}
|
|
||||||
|
|
||||||
private class FakeNodeFactoriesBindings(
|
private class FakeNodeFactoriesBindings(
|
||||||
private val nodeFactories: Map<KClass<out Node>, AssistedNodeFactory<*>>,
|
private val nodeFactories: Map<KClass<out Node>, AssistedNodeFactory<*>>,
|
||||||
) : NodeFactoriesBindings {
|
) : NodeFactoriesBindings {
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
* Please see LICENSE files in the repository root for full details.
|
* Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.tests.testutils
|
package io.element.android.tests.testutils.presenter
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2026 Element Creations 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.tests.testutils.presenter
|
||||||
|
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import io.element.android.libraries.architecture.Presenter
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A presenter that cannot be used, util for testing Nodes.
|
||||||
|
*/
|
||||||
|
class NotUsedPresenter<T> : Presenter<T> {
|
||||||
|
@Composable
|
||||||
|
override fun present(): T = error("Not used")
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user