mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Ensure that we can "not filter" the rooms.
This commit is contained in:
committed by
Benoit Marty
parent
1444436d3e
commit
8005fa6f91
+2
@@ -20,6 +20,7 @@ sealed interface RoomListFilter {
|
|||||||
companion object {
|
companion object {
|
||||||
/**
|
/**
|
||||||
* Create a filter that matches all the given filters.
|
* Create a filter that matches all the given filters.
|
||||||
|
* If not filters are provided, all the room will match.
|
||||||
*/
|
*/
|
||||||
fun all(vararg filters: RoomListFilter): RoomListFilter {
|
fun all(vararg filters: RoomListFilter): RoomListFilter {
|
||||||
return All(filters.toList())
|
return All(filters.toList())
|
||||||
@@ -35,6 +36,7 @@ sealed interface RoomListFilter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A filter that matches all the given filters.
|
* A filter that matches all the given filters.
|
||||||
|
* If [filters] is empty, all the room will match.
|
||||||
*/
|
*/
|
||||||
data class All(
|
data class All(
|
||||||
val filters: List<RoomListFilter>
|
val filters: List<RoomListFilter>
|
||||||
|
|||||||
+6
@@ -136,4 +136,10 @@ class RoomListFilterTest {
|
|||||||
)
|
)
|
||||||
assertThat(roomSummaries.filter(filter)).isEmpty()
|
assertThat(roomSummaries.filter(filter)).isEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `Room list filter all with empty list`() = runTest {
|
||||||
|
val filter = RoomListFilter.all()
|
||||||
|
assertThat(roomSummaries.filter(filter)).isEqualTo(roomSummaries)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user