Format files.
This commit is contained in:
parent
6880cf518c
commit
028741d81c
9 changed files with 48 additions and 48 deletions
|
|
@ -35,7 +35,7 @@ import org.matrix.rustcomponents.sdk.NotificationStatus
|
||||||
import org.matrix.rustcomponents.sdk.TimelineEventType
|
import org.matrix.rustcomponents.sdk.TimelineEventType
|
||||||
|
|
||||||
class RustNotificationServiceTest {
|
class RustNotificationServiceTest {
|
||||||
@Test
|
@Test
|
||||||
fun test() = runTest {
|
fun test() = runTest {
|
||||||
val notificationClient = FakeFfiNotificationClient(
|
val notificationClient = FakeFfiNotificationClient(
|
||||||
notificationItemResult = mapOf(AN_EVENT_ID.value to aRustBatchNotificationResult()),
|
notificationItemResult = mapOf(AN_EVENT_ID.value to aRustBatchNotificationResult()),
|
||||||
|
|
@ -56,7 +56,7 @@ class RustNotificationServiceTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test mapping invalid item only drops that item`() = runTest {
|
fun `test mapping invalid item only drops that item`() = runTest {
|
||||||
val error = IllegalStateException("This event type is not supported")
|
val error = IllegalStateException("This event type is not supported")
|
||||||
val faultyEvent = object : FakeFfiTimelineEvent() {
|
val faultyEvent = object : FakeFfiTimelineEvent() {
|
||||||
|
|
@ -83,7 +83,7 @@ class RustNotificationServiceTest {
|
||||||
assertThat(successfulResult?.isSuccess).isTrue()
|
assertThat(successfulResult?.isSuccess).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test unable to resolve event`() = runTest {
|
fun `test unable to resolve event`() = runTest {
|
||||||
val notificationClient = FakeFfiNotificationClient(
|
val notificationClient = FakeFfiNotificationClient(
|
||||||
notificationItemResult = emptyMap(),
|
notificationItemResult = emptyMap(),
|
||||||
|
|
@ -95,7 +95,7 @@ class RustNotificationServiceTest {
|
||||||
assertThat(exception).isInstanceOf(NotificationResolverException::class.java)
|
assertThat(exception).isInstanceOf(NotificationResolverException::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `close should invoke the close method of the service`() = runTest {
|
fun `close should invoke the close method of the service`() = runTest {
|
||||||
val closeResult = lambdaRecorder<Unit> { }
|
val closeResult = lambdaRecorder<Unit> { }
|
||||||
val notificationClient = FakeFfiNotificationClient(
|
val notificationClient = FakeFfiNotificationClient(
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import org.junit.Test
|
||||||
import org.matrix.rustcomponents.sdk.NotificationSettings
|
import org.matrix.rustcomponents.sdk.NotificationSettings
|
||||||
|
|
||||||
class RustNotificationSettingsServiceTest {
|
class RustNotificationSettingsServiceTest {
|
||||||
@Test
|
@Test
|
||||||
fun test() = runTest {
|
fun test() = runTest {
|
||||||
val sut = createRustNotificationSettingsService()
|
val sut = createRustNotificationSettingsService()
|
||||||
val result = sut.getRoomNotificationSettings(
|
val result = sut.getRoomNotificationSettings(
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class RustBaseRoomDirectoryServiceTest {
|
class RustBaseRoomDirectoryServiceTest {
|
||||||
@Test
|
@Test
|
||||||
fun test() = runTest {
|
fun test() = runTest {
|
||||||
val client = FakeFfiClient()
|
val client = FakeFfiClient()
|
||||||
val sut = RustRoomDirectoryService(
|
val sut = RustRoomDirectoryService(
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import org.junit.Test
|
||||||
import kotlin.coroutines.EmptyCoroutineContext
|
import kotlin.coroutines.EmptyCoroutineContext
|
||||||
|
|
||||||
class RoomListFactoryTest {
|
class RoomListFactoryTest {
|
||||||
@Test
|
@Test
|
||||||
fun `createRoomList should work`() = runTest {
|
fun `createRoomList should work`() = runTest {
|
||||||
val sut = RoomListFactory(
|
val sut = RoomListFactory(
|
||||||
innerRoomListService = FakeFfiRoomListService(),
|
innerRoomListService = FakeFfiRoomListService(),
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ import org.matrix.rustcomponents.sdk.RoomListEntriesUpdate
|
||||||
class RoomSummaryListProcessorTest {
|
class RoomSummaryListProcessorTest {
|
||||||
private val summaries = MutableStateFlow<List<RoomSummary>>(emptyList())
|
private val summaries = MutableStateFlow<List<RoomSummary>>(emptyList())
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Append adds new entries at the end of the list`() = runTest {
|
fun `Append adds new entries at the end of the list`() = runTest {
|
||||||
summaries.value = listOf(aRoomSummary())
|
summaries.value = listOf(aRoomSummary())
|
||||||
val processor = createProcessor()
|
val processor = createProcessor()
|
||||||
|
|
@ -40,7 +40,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(summaries.value.subList(1, 4).all { it.roomId == A_ROOM_ID_2 }).isTrue()
|
assertThat(summaries.value.subList(1, 4).all { it.roomId == A_ROOM_ID_2 }).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `PushBack adds a new entry at the end of the list`() = runTest {
|
fun `PushBack adds a new entry at the end of the list`() = runTest {
|
||||||
summaries.value = listOf(aRoomSummary())
|
summaries.value = listOf(aRoomSummary())
|
||||||
val processor = createProcessor()
|
val processor = createProcessor()
|
||||||
|
|
@ -50,7 +50,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(summaries.value.last().roomId).isEqualTo(A_ROOM_ID_2)
|
assertThat(summaries.value.last().roomId).isEqualTo(A_ROOM_ID_2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `PushFront inserts a new entry at the start of the list`() = runTest {
|
fun `PushFront inserts a new entry at the start of the list`() = runTest {
|
||||||
summaries.value = listOf(aRoomSummary())
|
summaries.value = listOf(aRoomSummary())
|
||||||
val processor = createProcessor()
|
val processor = createProcessor()
|
||||||
|
|
@ -60,7 +60,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(summaries.value.first().roomId).isEqualTo(A_ROOM_ID_2)
|
assertThat(summaries.value.first().roomId).isEqualTo(A_ROOM_ID_2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Set replaces an entry at some index`() = runTest {
|
fun `Set replaces an entry at some index`() = runTest {
|
||||||
summaries.value = listOf(aRoomSummary())
|
summaries.value = listOf(aRoomSummary())
|
||||||
val processor = createProcessor()
|
val processor = createProcessor()
|
||||||
|
|
@ -72,7 +72,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID_2)
|
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID_2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Insert inserts a new entry at the provided index`() = runTest {
|
fun `Insert inserts a new entry at the provided index`() = runTest {
|
||||||
summaries.value = listOf(aRoomSummary())
|
summaries.value = listOf(aRoomSummary())
|
||||||
val processor = createProcessor()
|
val processor = createProcessor()
|
||||||
|
|
@ -84,7 +84,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID_2)
|
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID_2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Remove removes an entry at some index`() = runTest {
|
fun `Remove removes an entry at some index`() = runTest {
|
||||||
summaries.value = listOf(
|
summaries.value = listOf(
|
||||||
aRoomSummary(roomId = A_ROOM_ID),
|
aRoomSummary(roomId = A_ROOM_ID),
|
||||||
|
|
@ -99,7 +99,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID_2)
|
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID_2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `PopBack removes an entry at the end of the list`() = runTest {
|
fun `PopBack removes an entry at the end of the list`() = runTest {
|
||||||
summaries.value = listOf(
|
summaries.value = listOf(
|
||||||
aRoomSummary(roomId = A_ROOM_ID),
|
aRoomSummary(roomId = A_ROOM_ID),
|
||||||
|
|
@ -114,7 +114,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID)
|
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `PopFront removes an entry at the start of the list`() = runTest {
|
fun `PopFront removes an entry at the start of the list`() = runTest {
|
||||||
summaries.value = listOf(
|
summaries.value = listOf(
|
||||||
aRoomSummary(roomId = A_ROOM_ID),
|
aRoomSummary(roomId = A_ROOM_ID),
|
||||||
|
|
@ -129,7 +129,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID_2)
|
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID_2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Clear removes all the entries`() = runTest {
|
fun `Clear removes all the entries`() = runTest {
|
||||||
summaries.value = listOf(
|
summaries.value = listOf(
|
||||||
aRoomSummary(roomId = A_ROOM_ID),
|
aRoomSummary(roomId = A_ROOM_ID),
|
||||||
|
|
@ -142,7 +142,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(summaries.value).isEmpty()
|
assertThat(summaries.value).isEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Truncate removes all entries after the provided length`() = runTest {
|
fun `Truncate removes all entries after the provided length`() = runTest {
|
||||||
summaries.value = listOf(
|
summaries.value = listOf(
|
||||||
aRoomSummary(roomId = A_ROOM_ID),
|
aRoomSummary(roomId = A_ROOM_ID),
|
||||||
|
|
@ -157,7 +157,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID)
|
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Reset removes all entries and add the provided ones`() = runTest {
|
fun `Reset removes all entries and add the provided ones`() = runTest {
|
||||||
summaries.value = listOf(
|
summaries.value = listOf(
|
||||||
aRoomSummary(roomId = A_ROOM_ID),
|
aRoomSummary(roomId = A_ROOM_ID),
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import org.matrix.rustcomponents.sdk.SpaceListUpdate
|
||||||
class RoomSummaryListProcessorTest {
|
class RoomSummaryListProcessorTest {
|
||||||
private val spaceRoomsFlow = MutableStateFlow<List<SpaceRoom>>(emptyList())
|
private val spaceRoomsFlow = MutableStateFlow<List<SpaceRoom>>(emptyList())
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Append adds new entries at the end of the list`() = runTest {
|
fun `Append adds new entries at the end of the list`() = runTest {
|
||||||
spaceRoomsFlow.value = listOf(aSpaceRoom())
|
spaceRoomsFlow.value = listOf(aSpaceRoom())
|
||||||
val processor = createProcessor()
|
val processor = createProcessor()
|
||||||
|
|
@ -36,7 +36,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(spaceRoomsFlow.value.subList(1, 4).all { it.roomId == A_ROOM_ID_2 }).isTrue()
|
assertThat(spaceRoomsFlow.value.subList(1, 4).all { it.roomId == A_ROOM_ID_2 }).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `PushBack adds a new entry at the end of the list`() = runTest {
|
fun `PushBack adds a new entry at the end of the list`() = runTest {
|
||||||
spaceRoomsFlow.value = listOf(aSpaceRoom())
|
spaceRoomsFlow.value = listOf(aSpaceRoom())
|
||||||
val processor = createProcessor()
|
val processor = createProcessor()
|
||||||
|
|
@ -46,7 +46,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(spaceRoomsFlow.value.last().roomId).isEqualTo(A_ROOM_ID_2)
|
assertThat(spaceRoomsFlow.value.last().roomId).isEqualTo(A_ROOM_ID_2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `PushFront inserts a new entry at the start of the list`() = runTest {
|
fun `PushFront inserts a new entry at the start of the list`() = runTest {
|
||||||
spaceRoomsFlow.value = listOf(aSpaceRoom())
|
spaceRoomsFlow.value = listOf(aSpaceRoom())
|
||||||
val processor = createProcessor()
|
val processor = createProcessor()
|
||||||
|
|
@ -56,7 +56,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(spaceRoomsFlow.value.first().roomId).isEqualTo(A_ROOM_ID_2)
|
assertThat(spaceRoomsFlow.value.first().roomId).isEqualTo(A_ROOM_ID_2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Set replaces an entry at some index`() = runTest {
|
fun `Set replaces an entry at some index`() = runTest {
|
||||||
spaceRoomsFlow.value = listOf(aSpaceRoom())
|
spaceRoomsFlow.value = listOf(aSpaceRoom())
|
||||||
val processor = createProcessor()
|
val processor = createProcessor()
|
||||||
|
|
@ -68,7 +68,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_2)
|
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Insert inserts a new entry at the provided index`() = runTest {
|
fun `Insert inserts a new entry at the provided index`() = runTest {
|
||||||
spaceRoomsFlow.value = listOf(aSpaceRoom())
|
spaceRoomsFlow.value = listOf(aSpaceRoom())
|
||||||
val processor = createProcessor()
|
val processor = createProcessor()
|
||||||
|
|
@ -80,7 +80,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_2)
|
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Remove removes an entry at some index`() = runTest {
|
fun `Remove removes an entry at some index`() = runTest {
|
||||||
spaceRoomsFlow.value = listOf(
|
spaceRoomsFlow.value = listOf(
|
||||||
aSpaceRoom(roomId = A_ROOM_ID),
|
aSpaceRoom(roomId = A_ROOM_ID),
|
||||||
|
|
@ -95,7 +95,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_2)
|
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `PopBack removes an entry at the end of the list`() = runTest {
|
fun `PopBack removes an entry at the end of the list`() = runTest {
|
||||||
spaceRoomsFlow.value = listOf(
|
spaceRoomsFlow.value = listOf(
|
||||||
aSpaceRoom(roomId = A_ROOM_ID),
|
aSpaceRoom(roomId = A_ROOM_ID),
|
||||||
|
|
@ -110,7 +110,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID)
|
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `PopFront removes an entry at the start of the list`() = runTest {
|
fun `PopFront removes an entry at the start of the list`() = runTest {
|
||||||
spaceRoomsFlow.value = listOf(
|
spaceRoomsFlow.value = listOf(
|
||||||
aSpaceRoom(roomId = A_ROOM_ID),
|
aSpaceRoom(roomId = A_ROOM_ID),
|
||||||
|
|
@ -125,7 +125,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_2)
|
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Clear removes all the entries`() = runTest {
|
fun `Clear removes all the entries`() = runTest {
|
||||||
spaceRoomsFlow.value = listOf(
|
spaceRoomsFlow.value = listOf(
|
||||||
aSpaceRoom(roomId = A_ROOM_ID),
|
aSpaceRoom(roomId = A_ROOM_ID),
|
||||||
|
|
@ -138,7 +138,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(spaceRoomsFlow.value).isEmpty()
|
assertThat(spaceRoomsFlow.value).isEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Truncate removes all entries after the provided length`() = runTest {
|
fun `Truncate removes all entries after the provided length`() = runTest {
|
||||||
spaceRoomsFlow.value = listOf(
|
spaceRoomsFlow.value = listOf(
|
||||||
aSpaceRoom(roomId = A_ROOM_ID),
|
aSpaceRoom(roomId = A_ROOM_ID),
|
||||||
|
|
@ -153,7 +153,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID)
|
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Reset removes all entries and add the provided ones`() = runTest {
|
fun `Reset removes all entries and add the provided ones`() = runTest {
|
||||||
spaceRoomsFlow.value = listOf(
|
spaceRoomsFlow.value = listOf(
|
||||||
aSpaceRoom(roomId = A_ROOM_ID),
|
aSpaceRoom(roomId = A_ROOM_ID),
|
||||||
|
|
@ -168,7 +168,7 @@ class RoomSummaryListProcessorTest {
|
||||||
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_3)
|
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_3)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `When there is no replay cache SpaceListUpdateProcessor starts with an empty list`() = runTest {
|
fun `When there is no replay cache SpaceListUpdateProcessor starts with an empty list`() = runTest {
|
||||||
val spaceRoomsSharedFlow = MutableSharedFlow<List<SpaceRoom>>(replay = 1)
|
val spaceRoomsSharedFlow = MutableSharedFlow<List<SpaceRoom>>(replay = 1)
|
||||||
val processor = createProcessor(
|
val processor = createProcessor(
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ import uniffi.matrix_sdk_ui.SpaceRoomListPaginationState
|
||||||
import org.matrix.rustcomponents.sdk.SpaceRoomList as InnerSpaceRoomList
|
import org.matrix.rustcomponents.sdk.SpaceRoomList as InnerSpaceRoomList
|
||||||
|
|
||||||
class RustSpaceRoomListTest {
|
class RustSpaceRoomListTest {
|
||||||
@Test
|
@Test
|
||||||
fun `paginationStatusFlow emits values`() = runTest {
|
fun `paginationStatusFlow emits values`() = runTest {
|
||||||
val innerSpaceRoomList = FakeFfiSpaceRoomList(
|
val innerSpaceRoomList = FakeFfiSpaceRoomList(
|
||||||
paginationStateResult = { SpaceRoomListPaginationState.Idle(false) }
|
paginationStateResult = { SpaceRoomListPaginationState.Idle(false) }
|
||||||
|
|
@ -51,7 +51,7 @@ class RustSpaceRoomListTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `spaceRoomsFlow emits values`() = runTest {
|
fun `spaceRoomsFlow emits values`() = runTest {
|
||||||
val innerSpaceRoomList = FakeFfiSpaceRoomList(
|
val innerSpaceRoomList = FakeFfiSpaceRoomList(
|
||||||
paginationStateResult = { SpaceRoomListPaginationState.Idle(false) }
|
paginationStateResult = { SpaceRoomListPaginationState.Idle(false) }
|
||||||
|
|
@ -73,7 +73,7 @@ class RustSpaceRoomListTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `paginate invokes paginate on the inner class`() = runTest {
|
fun `paginate invokes paginate on the inner class`() = runTest {
|
||||||
val paginateResult = lambdaRecorder<Unit> { }
|
val paginateResult = lambdaRecorder<Unit> { }
|
||||||
val innerSpaceRoomList = FakeFfiSpaceRoomList(
|
val innerSpaceRoomList = FakeFfiSpaceRoomList(
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class MatrixTimelineDiffProcessorTest {
|
||||||
private val anEvent = MatrixTimelineItem.Event(A_UNIQUE_ID, anEventTimelineItem())
|
private val anEvent = MatrixTimelineItem.Event(A_UNIQUE_ID, anEventTimelineItem())
|
||||||
private val anEvent2 = MatrixTimelineItem.Event(A_UNIQUE_ID_2, anEventTimelineItem())
|
private val anEvent2 = MatrixTimelineItem.Event(A_UNIQUE_ID_2, anEventTimelineItem())
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Append adds new entries at the end of the list`() = runTest {
|
fun `Append adds new entries at the end of the list`() = runTest {
|
||||||
timelineItems.value = listOf(anEvent)
|
timelineItems.value = listOf(anEvent)
|
||||||
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
||||||
|
|
@ -42,7 +42,7 @@ class MatrixTimelineDiffProcessorTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `PushBack adds a new entry at the end of the list`() = runTest {
|
fun `PushBack adds a new entry at the end of the list`() = runTest {
|
||||||
timelineItems.value = listOf(anEvent)
|
timelineItems.value = listOf(anEvent)
|
||||||
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
||||||
|
|
@ -54,7 +54,7 @@ class MatrixTimelineDiffProcessorTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `PushFront inserts a new entry at the start of the list`() = runTest {
|
fun `PushFront inserts a new entry at the start of the list`() = runTest {
|
||||||
timelineItems.value = listOf(anEvent)
|
timelineItems.value = listOf(anEvent)
|
||||||
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
||||||
|
|
@ -66,7 +66,7 @@ class MatrixTimelineDiffProcessorTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Set replaces an entry at some index`() = runTest {
|
fun `Set replaces an entry at some index`() = runTest {
|
||||||
timelineItems.value = listOf(anEvent, anEvent2)
|
timelineItems.value = listOf(anEvent, anEvent2)
|
||||||
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
||||||
|
|
@ -78,7 +78,7 @@ class MatrixTimelineDiffProcessorTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Insert inserts a new entry at the provided index`() = runTest {
|
fun `Insert inserts a new entry at the provided index`() = runTest {
|
||||||
timelineItems.value = listOf(anEvent, anEvent2)
|
timelineItems.value = listOf(anEvent, anEvent2)
|
||||||
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
||||||
|
|
@ -91,7 +91,7 @@ class MatrixTimelineDiffProcessorTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Remove removes an entry at some index`() = runTest {
|
fun `Remove removes an entry at some index`() = runTest {
|
||||||
timelineItems.value = listOf(anEvent, MatrixTimelineItem.Other, anEvent2)
|
timelineItems.value = listOf(anEvent, MatrixTimelineItem.Other, anEvent2)
|
||||||
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
||||||
|
|
@ -103,7 +103,7 @@ class MatrixTimelineDiffProcessorTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `PopBack removes an entry at the end of the list`() = runTest {
|
fun `PopBack removes an entry at the end of the list`() = runTest {
|
||||||
timelineItems.value = listOf(anEvent, anEvent2)
|
timelineItems.value = listOf(anEvent, anEvent2)
|
||||||
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
||||||
|
|
@ -114,7 +114,7 @@ class MatrixTimelineDiffProcessorTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `PopFront removes an entry at the start of the list`() = runTest {
|
fun `PopFront removes an entry at the start of the list`() = runTest {
|
||||||
timelineItems.value = listOf(anEvent, anEvent2)
|
timelineItems.value = listOf(anEvent, anEvent2)
|
||||||
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
||||||
|
|
@ -125,7 +125,7 @@ class MatrixTimelineDiffProcessorTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Clear removes all the entries`() = runTest {
|
fun `Clear removes all the entries`() = runTest {
|
||||||
timelineItems.value = listOf(anEvent, anEvent2)
|
timelineItems.value = listOf(anEvent, anEvent2)
|
||||||
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
||||||
|
|
@ -133,7 +133,7 @@ class MatrixTimelineDiffProcessorTest {
|
||||||
assertThat(timelineItems.value).isEmpty()
|
assertThat(timelineItems.value).isEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Truncate removes all entries after the provided length`() = runTest {
|
fun `Truncate removes all entries after the provided length`() = runTest {
|
||||||
timelineItems.value = listOf(anEvent, MatrixTimelineItem.Other, anEvent2)
|
timelineItems.value = listOf(anEvent, MatrixTimelineItem.Other, anEvent2)
|
||||||
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
||||||
|
|
@ -144,7 +144,7 @@ class MatrixTimelineDiffProcessorTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Reset removes all entries and add the provided ones`() = runTest {
|
fun `Reset removes all entries and add the provided ones`() = runTest {
|
||||||
timelineItems.value = listOf(anEvent, MatrixTimelineItem.Other, anEvent2)
|
timelineItems.value = listOf(anEvent, MatrixTimelineItem.Other, anEvent2)
|
||||||
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
val processor = createMatrixTimelineDiffProcessor(timelineItems)
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ import uniffi.matrix_sdk_ui.EventItemOrigin
|
||||||
|
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
class TimelineItemsSubscriberTest {
|
class TimelineItemsSubscriberTest {
|
||||||
@Test
|
@Test
|
||||||
fun `when timeline emits an empty list of items, the flow must emits an empty list`() = runTest {
|
fun `when timeline emits an empty list of items, the flow must emits an empty list`() = runTest {
|
||||||
val timelineItems: MutableSharedFlow<List<MatrixTimelineItem>> =
|
val timelineItems: MutableSharedFlow<List<MatrixTimelineItem>> =
|
||||||
MutableSharedFlow(replay = 1, extraBufferCapacity = Int.MAX_VALUE)
|
MutableSharedFlow(replay = 1, extraBufferCapacity = Int.MAX_VALUE)
|
||||||
|
|
@ -50,7 +50,7 @@ class TimelineItemsSubscriberTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `when timeline emits a non empty list of items, the flow must emits a non empty list`() = runTest {
|
fun `when timeline emits a non empty list of items, the flow must emits a non empty list`() = runTest {
|
||||||
val timelineItems: MutableSharedFlow<List<MatrixTimelineItem>> =
|
val timelineItems: MutableSharedFlow<List<MatrixTimelineItem>> =
|
||||||
MutableSharedFlow(replay = 1, extraBufferCapacity = Int.MAX_VALUE)
|
MutableSharedFlow(replay = 1, extraBufferCapacity = Int.MAX_VALUE)
|
||||||
|
|
@ -73,7 +73,7 @@ class TimelineItemsSubscriberTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `when timeline emits an item with SYNC origin`() = runTest {
|
fun `when timeline emits an item with SYNC origin`() = runTest {
|
||||||
val timelineItems: MutableSharedFlow<List<MatrixTimelineItem>> =
|
val timelineItems: MutableSharedFlow<List<MatrixTimelineItem>> =
|
||||||
MutableSharedFlow(replay = 1, extraBufferCapacity = Int.MAX_VALUE)
|
MutableSharedFlow(replay = 1, extraBufferCapacity = Int.MAX_VALUE)
|
||||||
|
|
@ -104,7 +104,7 @@ class TimelineItemsSubscriberTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `multiple subscriptions does not have side effect`() = runTest {
|
fun `multiple subscriptions does not have side effect`() = runTest {
|
||||||
val timelineItemsSubscriber = createTimelineItemsSubscriber()
|
val timelineItemsSubscriber = createTimelineItemsSubscriber()
|
||||||
timelineItemsSubscriber.subscribeIfNeeded()
|
timelineItemsSubscriber.subscribeIfNeeded()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue