Merge pull request #5462 from element-hq/feature/bma/enableSpaces
Add support for Spaces
This commit is contained in:
commit
3f54017ec3
2 changed files with 10 additions and 4 deletions
|
|
@ -34,6 +34,7 @@ import io.element.android.libraries.matrix.test.AN_EXCEPTION
|
|||
import io.element.android.libraries.matrix.test.A_USER_ID
|
||||
import io.element.android.libraries.matrix.test.A_USER_NAME
|
||||
import io.element.android.libraries.matrix.test.FakeMatrixClient
|
||||
import io.element.android.libraries.matrix.test.core.aBuildMeta
|
||||
import io.element.android.libraries.matrix.test.sync.FakeSyncService
|
||||
import io.element.android.libraries.sessionstorage.api.SessionStore
|
||||
import io.element.android.libraries.sessionstorage.test.InMemorySessionStore
|
||||
|
|
@ -52,6 +53,8 @@ class HomePresenterTest {
|
|||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
private val isSpaceEnabled = FeatureFlags.Space.defaultValue(aBuildMeta())
|
||||
|
||||
@Test
|
||||
fun `present - should start with no user and then load user with success`() = runTest {
|
||||
val matrixClient = FakeMatrixClient(
|
||||
|
|
@ -75,6 +78,7 @@ class HomePresenterTest {
|
|||
moleculeFlow(RecompositionMode.Immediate) {
|
||||
presenter.present()
|
||||
}.test {
|
||||
if (isSpaceEnabled) skipItems(1)
|
||||
val initialState = awaitItem()
|
||||
assertThat(initialState.currentUserAndNeighbors.first()).isEqualTo(
|
||||
MatrixUser(A_USER_ID, null, null)
|
||||
|
|
@ -86,8 +90,8 @@ class HomePresenterTest {
|
|||
MatrixUser(A_USER_ID, A_USER_NAME, AN_AVATAR_URL)
|
||||
)
|
||||
assertThat(withUserState.showAvatarIndicator).isFalse()
|
||||
assertThat(withUserState.isSpaceFeatureEnabled).isFalse()
|
||||
assertThat(withUserState.showNavigationBar).isFalse()
|
||||
assertThat(withUserState.isSpaceFeatureEnabled).isEqualTo(isSpaceEnabled)
|
||||
assertThat(withUserState.showNavigationBar).isEqualTo(isSpaceEnabled)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -138,6 +142,7 @@ class HomePresenterTest {
|
|||
moleculeFlow(RecompositionMode.Immediate) {
|
||||
presenter.present()
|
||||
}.test {
|
||||
if (isSpaceEnabled) skipItems(1)
|
||||
val initialState = awaitItem()
|
||||
assertThat(initialState.showAvatarIndicator).isFalse()
|
||||
indicatorService.setShowRoomListTopBarIndicator(true)
|
||||
|
|
@ -162,6 +167,7 @@ class HomePresenterTest {
|
|||
moleculeFlow(RecompositionMode.Immediate) {
|
||||
presenter.present()
|
||||
}.test {
|
||||
if (isSpaceEnabled) skipItems(1)
|
||||
val initialState = awaitItem()
|
||||
assertThat(initialState.currentUserAndNeighbors.first()).isEqualTo(MatrixUser(matrixClient.sessionId))
|
||||
// No new state is coming
|
||||
|
|
@ -182,6 +188,7 @@ class HomePresenterTest {
|
|||
moleculeFlow(RecompositionMode.Immediate) {
|
||||
presenter.present()
|
||||
}.test {
|
||||
if (isSpaceEnabled) skipItems(1)
|
||||
val initialState = awaitItem()
|
||||
assertThat(initialState.currentHomeNavigationBarItem).isEqualTo(HomeNavigationBarItem.Chats)
|
||||
initialState.eventSink(HomeEvents.SelectHomeNavigationBarItem(HomeNavigationBarItem.Spaces))
|
||||
|
|
|
|||
|
|
@ -71,8 +71,7 @@ enum class FeatureFlags(
|
|||
Space(
|
||||
key = "feature.space",
|
||||
title = "Spaces",
|
||||
description = "Spaces are under active development, only developers should enable this flag for now.",
|
||||
defaultValue = { false },
|
||||
defaultValue = { true },
|
||||
isFinished = false,
|
||||
),
|
||||
PrintLogsToLogcat(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue