Add test on DefaultEntryPoints
This commit is contained in:
parent
a575019760
commit
a1aeb24f23
93 changed files with 2426 additions and 418 deletions
|
|
@ -29,7 +29,7 @@ class SignedOutPresenter(
|
|||
private val buildMeta: BuildMeta,
|
||||
) : Presenter<SignedOutState> {
|
||||
@AssistedFactory
|
||||
interface Factory {
|
||||
fun interface Factory {
|
||||
fun create(sessionId: String): SignedOutPresenter
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* 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.signedout.impl
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.bumble.appyx.core.modality.BuildContext
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import io.element.android.features.signedout.api.SignedOutEntryPoint
|
||||
import io.element.android.libraries.matrix.test.A_SESSION_ID
|
||||
import io.element.android.tests.testutils.node.TestParentNode
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class DefaultSignedOutEntryPointTest {
|
||||
@Test
|
||||
fun `test node builder`() {
|
||||
val entryPoint = DefaultSignedOutEntryPoint()
|
||||
val parentNode = TestParentNode.create { buildContext, plugins ->
|
||||
SignedOutNode(
|
||||
buildContext = buildContext,
|
||||
plugins = plugins,
|
||||
presenterFactory = { sessionId ->
|
||||
assertThat(sessionId).isEqualTo(A_SESSION_ID.value)
|
||||
createSignedOutPresenter()
|
||||
}
|
||||
)
|
||||
}
|
||||
val params = SignedOutEntryPoint.Params(A_SESSION_ID)
|
||||
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
||||
.params(params)
|
||||
.build()
|
||||
assertThat(result).isInstanceOf(SignedOutNode::class.java)
|
||||
assertThat(result.plugins).contains(SignedOutNode.Inputs(params.sessionId))
|
||||
}
|
||||
}
|
||||
|
|
@ -22,12 +22,12 @@ import kotlinx.coroutines.test.runTest
|
|||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
private val appName = "AppName"
|
||||
|
||||
class SignedOutPresenterTest {
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
private val appName = "AppName"
|
||||
|
||||
@Test
|
||||
fun `present - initial state`() = runTest {
|
||||
val aSessionData = aSessionData()
|
||||
|
|
@ -64,15 +64,15 @@ class SignedOutPresenterTest {
|
|||
assertThat(sessionStore.getAllSessions()).isEmpty()
|
||||
}
|
||||
}
|
||||
|
||||
private fun createSignedOutPresenter(
|
||||
sessionId: SessionId = A_SESSION_ID,
|
||||
sessionStore: SessionStore = InMemorySessionStore(),
|
||||
): SignedOutPresenter {
|
||||
return SignedOutPresenter(
|
||||
sessionId = sessionId.value,
|
||||
sessionStore = sessionStore,
|
||||
buildMeta = aBuildMeta(applicationName = appName),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun createSignedOutPresenter(
|
||||
sessionId: SessionId = A_SESSION_ID,
|
||||
sessionStore: SessionStore = InMemorySessionStore(),
|
||||
): SignedOutPresenter {
|
||||
return SignedOutPresenter(
|
||||
sessionId = sessionId.value,
|
||||
sessionStore = sessionStore,
|
||||
buildMeta = aBuildMeta(applicationName = appName),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue