quality: add bunch of tests for Security&Privacy new features
This commit is contained in:
parent
92acf1edea
commit
cbb91500f3
7 changed files with 752 additions and 21 deletions
|
|
@ -9,6 +9,7 @@
|
|||
package io.element.android.features.securityandprivacy.impl
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.lifecycle.Lifecycle
|
||||
|
|
@ -71,7 +72,9 @@ class SecurityAndPrivacyFlowNode(
|
|||
}
|
||||
|
||||
private val callback: SecurityAndPrivacyEntryPoint.Callback = callback()
|
||||
private val navigator = BackstackSecurityAndPrivacyNavigator(callback, backstack)
|
||||
|
||||
@VisibleForTesting
|
||||
val navigator = BackstackSecurityAndPrivacyNavigator(callback, backstack)
|
||||
|
||||
override fun onBuilt() {
|
||||
super.onBuilt()
|
||||
|
|
|
|||
|
|
@ -20,14 +20,14 @@ open class ManageAuthorizedSpacesStateProvider : PreviewParameterProvider<Manage
|
|||
get() = sequenceOf(
|
||||
aManageAuthorizedSpacesState(),
|
||||
aManageAuthorizedSpacesState(
|
||||
authorizedSpacesData = anAuthorizedSpacesData(
|
||||
authorizedSpacesSelection = anAuthorizedSpaceSelection(
|
||||
unknownSpaceIds = listOf(aRoomId(99))
|
||||
)
|
||||
),
|
||||
aManageAuthorizedSpacesState(
|
||||
currentSelection = listOf(aRoomId(1), aRoomId(3)),
|
||||
authorizedSpacesData = anAuthorizedSpacesData(
|
||||
initialSelection = listOf(aRoomId(1)),
|
||||
selectedIds = listOf(aRoomId(1), aRoomId(3)),
|
||||
authorizedSpacesSelection = anAuthorizedSpaceSelection(
|
||||
initialSelectedIds = listOf(aRoomId(1)),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
@ -49,23 +49,23 @@ private fun aSpaceRoomList(count: Int): List<SpaceRoom> {
|
|||
}
|
||||
}
|
||||
|
||||
fun anAuthorizedSpacesData(
|
||||
fun anAuthorizedSpaceSelection(
|
||||
joinedSpaces: List<SpaceRoom> = aSpaceRoomList(5),
|
||||
unknownSpaceIds: List<RoomId> = emptyList(),
|
||||
initialSelection: List<RoomId> = emptyList(),
|
||||
initialSelectedIds: List<RoomId> = emptyList(),
|
||||
) = AuthorizedSpacesSelection(
|
||||
joinedSpaces = joinedSpaces.toImmutableList(),
|
||||
unknownSpaceIds = unknownSpaceIds.toImmutableList(),
|
||||
initialSelectedIds = initialSelection.toImmutableList(),
|
||||
initialSelectedIds = initialSelectedIds.toImmutableList(),
|
||||
)
|
||||
|
||||
private fun aManageAuthorizedSpacesState(
|
||||
authorizedSpacesData: AuthorizedSpacesSelection = anAuthorizedSpacesData(),
|
||||
currentSelection: List<RoomId> = emptyList(),
|
||||
authorizedSpacesSelection: AuthorizedSpacesSelection = anAuthorizedSpaceSelection(),
|
||||
selectedIds: List<RoomId> = emptyList(),
|
||||
eventSink: (ManageAuthorizedSpacesEvent) -> Unit = {},
|
||||
) = ManageAuthorizedSpacesState(
|
||||
selection = authorizedSpacesData,
|
||||
selectedIds = currentSelection.toImmutableList(),
|
||||
selection = authorizedSpacesSelection,
|
||||
selectedIds = selectedIds.toImmutableList(),
|
||||
isSelectionComplete = false,
|
||||
eventSink = eventSink,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue