Fix compilation and test
This commit is contained in:
parent
4ecd7a2417
commit
142c459861
2 changed files with 23 additions and 1 deletions
|
|
@ -20,6 +20,7 @@ import app.cash.molecule.RecompositionClock
|
|||
import app.cash.molecule.moleculeFlow
|
||||
import app.cash.turbine.test
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import io.element.android.features.login.impl.oidc.customtab.DefaultOidcActionFlow
|
||||
import io.element.android.features.login.impl.util.LoginConstants
|
||||
import io.element.android.libraries.architecture.Async
|
||||
import io.element.android.libraries.matrix.api.auth.MatrixHomeServerDetails
|
||||
|
|
@ -39,6 +40,7 @@ class LoginRootPresenterTest {
|
|||
fun `present - initial state`() = runTest {
|
||||
val presenter = LoginRootPresenter(
|
||||
FakeAuthenticationService(),
|
||||
DefaultOidcActionFlow(),
|
||||
)
|
||||
moleculeFlow(RecompositionClock.Immediate) {
|
||||
presenter.present()
|
||||
|
|
@ -56,8 +58,10 @@ class LoginRootPresenterTest {
|
|||
@Test
|
||||
fun `present - initial state server load`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val oidcActionFlow = DefaultOidcActionFlow()
|
||||
val presenter = LoginRootPresenter(
|
||||
authenticationService,
|
||||
oidcActionFlow,
|
||||
)
|
||||
moleculeFlow(RecompositionClock.Immediate) {
|
||||
presenter.present()
|
||||
|
|
@ -80,8 +84,10 @@ class LoginRootPresenterTest {
|
|||
@Test
|
||||
fun `present - initial state server load error and retry`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val oidcActionFlow = DefaultOidcActionFlow()
|
||||
val presenter = LoginRootPresenter(
|
||||
authenticationService,
|
||||
oidcActionFlow,
|
||||
)
|
||||
moleculeFlow(RecompositionClock.Immediate) {
|
||||
presenter.present()
|
||||
|
|
@ -113,8 +119,10 @@ class LoginRootPresenterTest {
|
|||
@Test
|
||||
fun `present - enter login and password`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val oidcActionFlow = DefaultOidcActionFlow()
|
||||
val presenter = LoginRootPresenter(
|
||||
authenticationService,
|
||||
oidcActionFlow,
|
||||
)
|
||||
authenticationService.givenHomeserver(A_HOMESERVER)
|
||||
moleculeFlow(RecompositionClock.Immediate) {
|
||||
|
|
@ -135,8 +143,10 @@ class LoginRootPresenterTest {
|
|||
@Test
|
||||
fun `present - oidc login`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val oidcActionFlow = DefaultOidcActionFlow()
|
||||
val presenter = LoginRootPresenter(
|
||||
authenticationService,
|
||||
oidcActionFlow,
|
||||
)
|
||||
authenticationService.givenHomeserver(A_HOMESERVER_OIDC)
|
||||
moleculeFlow(RecompositionClock.Immediate) {
|
||||
|
|
@ -153,8 +163,10 @@ class LoginRootPresenterTest {
|
|||
@Test
|
||||
fun `present - oidc login error`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val oidcActionFlow = DefaultOidcActionFlow()
|
||||
val presenter = LoginRootPresenter(
|
||||
authenticationService,
|
||||
oidcActionFlow,
|
||||
)
|
||||
authenticationService.givenHomeserver(A_HOMESERVER_OIDC)
|
||||
authenticationService.givenOidcError(A_THROWABLE)
|
||||
|
|
@ -172,8 +184,10 @@ class LoginRootPresenterTest {
|
|||
@Test
|
||||
fun `present - submit`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val oidcActionFlow = DefaultOidcActionFlow()
|
||||
val presenter = LoginRootPresenter(
|
||||
authenticationService,
|
||||
oidcActionFlow,
|
||||
)
|
||||
authenticationService.givenHomeserver(A_HOMESERVER)
|
||||
moleculeFlow(RecompositionClock.Immediate) {
|
||||
|
|
@ -195,8 +209,10 @@ class LoginRootPresenterTest {
|
|||
@Test
|
||||
fun `present - submit with error`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val oidcActionFlow = DefaultOidcActionFlow()
|
||||
val presenter = LoginRootPresenter(
|
||||
authenticationService,
|
||||
oidcActionFlow,
|
||||
)
|
||||
authenticationService.givenHomeserver(A_HOMESERVER)
|
||||
moleculeFlow(RecompositionClock.Immediate) {
|
||||
|
|
@ -219,8 +235,10 @@ class LoginRootPresenterTest {
|
|||
@Test
|
||||
fun `present - clear error`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val oidcActionFlow = DefaultOidcActionFlow()
|
||||
val presenter = LoginRootPresenter(
|
||||
authenticationService,
|
||||
oidcActionFlow,
|
||||
)
|
||||
authenticationService.givenHomeserver(A_HOMESERVER)
|
||||
moleculeFlow(RecompositionClock.Immediate) {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package io.element.android.samples.minimal
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import io.element.android.features.login.impl.oidc.customtab.DefaultOidcActionFlow
|
||||
import io.element.android.features.login.impl.root.LoginRootPresenter
|
||||
import io.element.android.features.login.impl.root.LoginRootView
|
||||
import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
|
||||
|
|
@ -28,7 +29,10 @@ class LoginScreen(private val authenticationService: MatrixAuthenticationService
|
|||
@Composable
|
||||
fun Content(modifier: Modifier = Modifier) {
|
||||
val presenter = remember {
|
||||
LoginRootPresenter(authenticationService = authenticationService)
|
||||
LoginRootPresenter(
|
||||
authenticationService = authenticationService,
|
||||
DefaultOidcActionFlow()
|
||||
)
|
||||
}
|
||||
val state = presenter.present()
|
||||
LoginRootView(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue