mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-05 12:54:35 +00:00
Fix quality issues.
This commit is contained in:
+1
-2
@@ -13,8 +13,7 @@ import org.matrix.rustcomponents.sdk.Timeline
|
||||
import org.matrix.rustcomponents.sdk.TimelineDiff
|
||||
import org.matrix.rustcomponents.sdk.TimelineListener
|
||||
|
||||
class FakeRustTimeline(
|
||||
) : Timeline(NoPointer) {
|
||||
class FakeRustTimeline : Timeline(NoPointer) {
|
||||
private var listener: TimelineListener? = null
|
||||
override suspend fun addListener(listener: TimelineListener): TaskHandle {
|
||||
this.listener = listener
|
||||
|
||||
+12
-4
@@ -33,7 +33,8 @@ import uniffi.matrix_sdk_ui.EventItemOrigin
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
class TimelineItemsSubscriberTest {
|
||||
@Test
|
||||
fun `when timeline emits an empty list of items, the flow must emits an empty list`() = runCancellableScopeTestWithTestScope { testScope, cancellableScope ->
|
||||
fun `when timeline emits an empty list of items, the flow must emits an empty list`() {
|
||||
runCancellableScopeTestWithTestScope { testScope, cancellableScope ->
|
||||
val timelineItems: MutableSharedFlow<List<MatrixTimelineItem>> =
|
||||
MutableSharedFlow(replay = 1, extraBufferCapacity = Int.MAX_VALUE)
|
||||
val timeline = FakeRustTimeline()
|
||||
@@ -52,9 +53,11 @@ class TimelineItemsSubscriberTest {
|
||||
timelineItemsSubscriber.unsubscribeIfNeeded()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `when timeline emits a non empty list of items, the flow must emits a non empty list`() = runCancellableScopeTestWithTestScope { testScope, cancellableScope ->
|
||||
fun `when timeline emits a non empty list of items, the flow must emits a non empty list`() {
|
||||
runCancellableScopeTestWithTestScope { testScope, cancellableScope ->
|
||||
val timelineItems: MutableSharedFlow<List<MatrixTimelineItem>> =
|
||||
MutableSharedFlow(replay = 1, extraBufferCapacity = Int.MAX_VALUE)
|
||||
val timeline = FakeRustTimeline()
|
||||
@@ -73,9 +76,11 @@ class TimelineItemsSubscriberTest {
|
||||
timelineItemsSubscriber.unsubscribeIfNeeded()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `when timeline emits an item with SYNC origin, the callback onNewSyncedEvent is invoked`() = runCancellableScopeTestWithTestScope { testScope, cancellableScope ->
|
||||
fun `when timeline emits an item with SYNC origin, the callback onNewSyncedEvent is invoked`() {
|
||||
runCancellableScopeTestWithTestScope { testScope, cancellableScope ->
|
||||
val timelineItems: MutableSharedFlow<List<MatrixTimelineItem>> =
|
||||
MutableSharedFlow(replay = 1, extraBufferCapacity = Int.MAX_VALUE)
|
||||
val timeline = FakeRustTimeline()
|
||||
@@ -106,9 +111,11 @@ class TimelineItemsSubscriberTest {
|
||||
}
|
||||
onNewSyncedEventRecorder.assertions().isCalledOnce()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `multiple subscriptions does not have side effect`() = runCancellableScopeTestWithTestScope { testScope, cancellableScope ->
|
||||
fun `multiple subscriptions does not have side effect`() {
|
||||
runCancellableScopeTestWithTestScope { testScope, cancellableScope ->
|
||||
val timelineItemsSubscriber = testScope.createTimelineItemsSubscriber(
|
||||
coroutineScope = cancellableScope,
|
||||
)
|
||||
@@ -117,6 +124,7 @@ class TimelineItemsSubscriberTest {
|
||||
timelineItemsSubscriber.unsubscribeIfNeeded()
|
||||
timelineItemsSubscriber.unsubscribeIfNeeded()
|
||||
}
|
||||
}
|
||||
|
||||
private fun TestScope.createTimelineItemsSubscriber(
|
||||
coroutineScope: CoroutineScope,
|
||||
|
||||
Reference in New Issue
Block a user