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