Create Fake classes in test modules
This commit is contained in:
@@ -9,11 +9,9 @@ package io.element.android.features.poll.impl.history
|
||||
|
||||
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
|
||||
import com.bumble.appyx.core.modality.BuildContext
|
||||
import com.bumble.appyx.core.node.Node
|
||||
import com.bumble.appyx.testing.junit4.util.MainDispatcherRule
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import io.element.android.features.poll.api.create.CreatePollEntryPoint
|
||||
import io.element.android.tests.testutils.lambda.lambdaError
|
||||
import io.element.android.features.poll.test.create.FakeCreatePollEntryPoint
|
||||
import io.element.android.tests.testutils.node.TestParentNode
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.Rule
|
||||
@@ -33,13 +31,7 @@ class DefaultPollHistoryEntryPointTest {
|
||||
PollHistoryFlowNode(
|
||||
buildContext = buildContext,
|
||||
plugins = plugins,
|
||||
createPollEntryPoint = object : CreatePollEntryPoint {
|
||||
context(parentNode: Node)
|
||||
override fun createNode(
|
||||
buildContext: BuildContext,
|
||||
params: CreatePollEntryPoint.Params,
|
||||
) = lambdaError()
|
||||
}
|
||||
createPollEntryPoint = FakeCreatePollEntryPoint(),
|
||||
)
|
||||
}
|
||||
val result = with(parentNode) {
|
||||
|
||||
@@ -17,4 +17,5 @@ dependencies {
|
||||
implementation(projects.libraries.matrix.api)
|
||||
api(projects.features.poll.api)
|
||||
implementation(libs.kotlinx.collections.immutable)
|
||||
implementation(projects.tests.testutils)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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.poll.test.create
|
||||
|
||||
import com.bumble.appyx.core.modality.BuildContext
|
||||
import com.bumble.appyx.core.node.Node
|
||||
import io.element.android.features.poll.api.create.CreatePollEntryPoint
|
||||
import io.element.android.features.poll.api.create.CreatePollEntryPoint.Params
|
||||
import io.element.android.tests.testutils.lambda.lambdaError
|
||||
|
||||
class FakeCreatePollEntryPoint : CreatePollEntryPoint {
|
||||
context(parentNode: Node)
|
||||
override fun createNode(
|
||||
buildContext: BuildContext,
|
||||
params: Params,
|
||||
): Node = lambdaError()
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* 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.poll.test.history
|
||||
|
||||
import com.bumble.appyx.core.modality.BuildContext
|
||||
import com.bumble.appyx.core.node.Node
|
||||
import io.element.android.features.poll.api.history.PollHistoryEntryPoint
|
||||
import io.element.android.tests.testutils.lambda.lambdaError
|
||||
|
||||
class FakePollHistoryEntryPoint : PollHistoryEntryPoint {
|
||||
context(parentNode: Node)
|
||||
override fun createNode(
|
||||
buildContext: BuildContext,
|
||||
): Node = lambdaError()
|
||||
}
|
||||
Reference in New Issue
Block a user