Format files.

This commit is contained in:
Benoit Marty 2025-12-16 16:13:25 +01:00
parent ad881c303a
commit 5ebb615751
9 changed files with 48 additions and 48 deletions

View file

@ -35,7 +35,7 @@ import org.matrix.rustcomponents.sdk.NotificationStatus
import org.matrix.rustcomponents.sdk.TimelineEventType
class RustNotificationServiceTest {
@Test
@Test
fun test() = runTest {
val notificationClient = FakeFfiNotificationClient(
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 {
val error = IllegalStateException("This event type is not supported")
val faultyEvent = object : FakeFfiTimelineEvent() {
@ -83,7 +83,7 @@ class RustNotificationServiceTest {
assertThat(successfulResult?.isSuccess).isTrue()
}
@Test
@Test
fun `test unable to resolve event`() = runTest {
val notificationClient = FakeFfiNotificationClient(
notificationItemResult = emptyMap(),
@ -95,7 +95,7 @@ class RustNotificationServiceTest {
assertThat(exception).isInstanceOf(NotificationResolverException::class.java)
}
@Test
@Test
fun `close should invoke the close method of the service`() = runTest {
val closeResult = lambdaRecorder<Unit> { }
val notificationClient = FakeFfiNotificationClient(

View file

@ -20,7 +20,7 @@ import org.junit.Test
import org.matrix.rustcomponents.sdk.NotificationSettings
class RustNotificationSettingsServiceTest {
@Test
@Test
fun test() = runTest {
val sut = createRustNotificationSettingsService()
val result = sut.getRoomNotificationSettings(

View file

@ -14,7 +14,7 @@ import kotlinx.coroutines.test.runTest
import org.junit.Test
class RustBaseRoomDirectoryServiceTest {
@Test
@Test
fun test() = runTest {
val client = FakeFfiClient()
val sut = RustRoomDirectoryService(

View file

@ -16,7 +16,7 @@ import org.junit.Test
import kotlin.coroutines.EmptyCoroutineContext
class RoomListFactoryTest {
@Test
@Test
fun `createRoomList should work`() = runTest {
val sut = RoomListFactory(
innerRoomListService = FakeFfiRoomListService(),

View file

@ -28,7 +28,7 @@ import org.matrix.rustcomponents.sdk.RoomListEntriesUpdate
class RoomSummaryListProcessorTest {
private val summaries = MutableStateFlow<List<RoomSummary>>(emptyList())
@Test
@Test
fun `Append adds new entries at the end of the list`() = runTest {
summaries.value = listOf(aRoomSummary())
val processor = createProcessor()
@ -40,7 +40,7 @@ class RoomSummaryListProcessorTest {
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 {
summaries.value = listOf(aRoomSummary())
val processor = createProcessor()
@ -50,7 +50,7 @@ class RoomSummaryListProcessorTest {
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 {
summaries.value = listOf(aRoomSummary())
val processor = createProcessor()
@ -60,7 +60,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value.first().roomId).isEqualTo(A_ROOM_ID_2)
}
@Test
@Test
fun `Set replaces an entry at some index`() = runTest {
summaries.value = listOf(aRoomSummary())
val processor = createProcessor()
@ -72,7 +72,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID_2)
}
@Test
@Test
fun `Insert inserts a new entry at the provided index`() = runTest {
summaries.value = listOf(aRoomSummary())
val processor = createProcessor()
@ -84,7 +84,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID_2)
}
@Test
@Test
fun `Remove removes an entry at some index`() = runTest {
summaries.value = listOf(
aRoomSummary(roomId = A_ROOM_ID),
@ -99,7 +99,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID_2)
}
@Test
@Test
fun `PopBack removes an entry at the end of the list`() = runTest {
summaries.value = listOf(
aRoomSummary(roomId = A_ROOM_ID),
@ -114,7 +114,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID)
}
@Test
@Test
fun `PopFront removes an entry at the start of the list`() = runTest {
summaries.value = listOf(
aRoomSummary(roomId = A_ROOM_ID),
@ -129,7 +129,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID_2)
}
@Test
@Test
fun `Clear removes all the entries`() = runTest {
summaries.value = listOf(
aRoomSummary(roomId = A_ROOM_ID),
@ -142,7 +142,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value).isEmpty()
}
@Test
@Test
fun `Truncate removes all entries after the provided length`() = runTest {
summaries.value = listOf(
aRoomSummary(roomId = A_ROOM_ID),
@ -157,7 +157,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID)
}
@Test
@Test
fun `Reset removes all entries and add the provided ones`() = runTest {
summaries.value = listOf(
aRoomSummary(roomId = A_ROOM_ID),

View file

@ -24,7 +24,7 @@ import org.matrix.rustcomponents.sdk.SpaceListUpdate
class RoomSummaryListProcessorTest {
private val spaceRoomsFlow = MutableStateFlow<List<SpaceRoom>>(emptyList())
@Test
@Test
fun `Append adds new entries at the end of the list`() = runTest {
spaceRoomsFlow.value = listOf(aSpaceRoom())
val processor = createProcessor()
@ -36,7 +36,7 @@ class RoomSummaryListProcessorTest {
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 {
spaceRoomsFlow.value = listOf(aSpaceRoom())
val processor = createProcessor()
@ -46,7 +46,7 @@ class RoomSummaryListProcessorTest {
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 {
spaceRoomsFlow.value = listOf(aSpaceRoom())
val processor = createProcessor()
@ -56,7 +56,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value.first().roomId).isEqualTo(A_ROOM_ID_2)
}
@Test
@Test
fun `Set replaces an entry at some index`() = runTest {
spaceRoomsFlow.value = listOf(aSpaceRoom())
val processor = createProcessor()
@ -68,7 +68,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_2)
}
@Test
@Test
fun `Insert inserts a new entry at the provided index`() = runTest {
spaceRoomsFlow.value = listOf(aSpaceRoom())
val processor = createProcessor()
@ -80,7 +80,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_2)
}
@Test
@Test
fun `Remove removes an entry at some index`() = runTest {
spaceRoomsFlow.value = listOf(
aSpaceRoom(roomId = A_ROOM_ID),
@ -95,7 +95,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_2)
}
@Test
@Test
fun `PopBack removes an entry at the end of the list`() = runTest {
spaceRoomsFlow.value = listOf(
aSpaceRoom(roomId = A_ROOM_ID),
@ -110,7 +110,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID)
}
@Test
@Test
fun `PopFront removes an entry at the start of the list`() = runTest {
spaceRoomsFlow.value = listOf(
aSpaceRoom(roomId = A_ROOM_ID),
@ -125,7 +125,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_2)
}
@Test
@Test
fun `Clear removes all the entries`() = runTest {
spaceRoomsFlow.value = listOf(
aSpaceRoom(roomId = A_ROOM_ID),
@ -138,7 +138,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value).isEmpty()
}
@Test
@Test
fun `Truncate removes all entries after the provided length`() = runTest {
spaceRoomsFlow.value = listOf(
aSpaceRoom(roomId = A_ROOM_ID),
@ -153,7 +153,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID)
}
@Test
@Test
fun `Reset removes all entries and add the provided ones`() = runTest {
spaceRoomsFlow.value = listOf(
aSpaceRoom(roomId = A_ROOM_ID),
@ -168,7 +168,7 @@ class RoomSummaryListProcessorTest {
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 {
val spaceRoomsSharedFlow = MutableSharedFlow<List<SpaceRoom>>(replay = 1)
val processor = createProcessor(

View file

@ -29,7 +29,7 @@ import uniffi.matrix_sdk_ui.SpaceRoomListPaginationState
import org.matrix.rustcomponents.sdk.SpaceRoomList as InnerSpaceRoomList
class RustSpaceRoomListTest {
@Test
@Test
fun `paginationStatusFlow emits values`() = runTest {
val innerSpaceRoomList = FakeFfiSpaceRoomList(
paginationStateResult = { SpaceRoomListPaginationState.Idle(false) }
@ -51,7 +51,7 @@ class RustSpaceRoomListTest {
}
}
@Test
@Test
fun `spaceRoomsFlow emits values`() = runTest {
val innerSpaceRoomList = FakeFfiSpaceRoomList(
paginationStateResult = { SpaceRoomListPaginationState.Idle(false) }
@ -73,7 +73,7 @@ class RustSpaceRoomListTest {
}
}
@Test
@Test
fun `paginate invokes paginate on the inner class`() = runTest {
val paginateResult = lambdaRecorder<Unit> { }
val innerSpaceRoomList = FakeFfiSpaceRoomList(

View file

@ -30,7 +30,7 @@ class MatrixTimelineDiffProcessorTest {
private val anEvent = MatrixTimelineItem.Event(A_UNIQUE_ID, 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 {
timelineItems.value = listOf(anEvent)
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 {
timelineItems.value = listOf(anEvent)
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 {
timelineItems.value = listOf(anEvent)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -66,7 +66,7 @@ class MatrixTimelineDiffProcessorTest {
)
}
@Test
@Test
fun `Set replaces an entry at some index`() = runTest {
timelineItems.value = listOf(anEvent, anEvent2)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -78,7 +78,7 @@ class MatrixTimelineDiffProcessorTest {
)
}
@Test
@Test
fun `Insert inserts a new entry at the provided index`() = runTest {
timelineItems.value = listOf(anEvent, anEvent2)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -91,7 +91,7 @@ class MatrixTimelineDiffProcessorTest {
)
}
@Test
@Test
fun `Remove removes an entry at some index`() = runTest {
timelineItems.value = listOf(anEvent, MatrixTimelineItem.Other, anEvent2)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -103,7 +103,7 @@ class MatrixTimelineDiffProcessorTest {
)
}
@Test
@Test
fun `PopBack removes an entry at the end of the list`() = runTest {
timelineItems.value = listOf(anEvent, anEvent2)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -114,7 +114,7 @@ class MatrixTimelineDiffProcessorTest {
)
}
@Test
@Test
fun `PopFront removes an entry at the start of the list`() = runTest {
timelineItems.value = listOf(anEvent, anEvent2)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -125,7 +125,7 @@ class MatrixTimelineDiffProcessorTest {
)
}
@Test
@Test
fun `Clear removes all the entries`() = runTest {
timelineItems.value = listOf(anEvent, anEvent2)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -133,7 +133,7 @@ class MatrixTimelineDiffProcessorTest {
assertThat(timelineItems.value).isEmpty()
}
@Test
@Test
fun `Truncate removes all entries after the provided length`() = runTest {
timelineItems.value = listOf(anEvent, MatrixTimelineItem.Other, anEvent2)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -144,7 +144,7 @@ class MatrixTimelineDiffProcessorTest {
)
}
@Test
@Test
fun `Reset removes all entries and add the provided ones`() = runTest {
timelineItems.value = listOf(anEvent, MatrixTimelineItem.Other, anEvent2)
val processor = createMatrixTimelineDiffProcessor(timelineItems)

View file

@ -27,7 +27,7 @@ import uniffi.matrix_sdk_ui.EventItemOrigin
@OptIn(ExperimentalCoroutinesApi::class)
class TimelineItemsSubscriberTest {
@Test
@Test
fun `when timeline emits an empty list of items, the flow must emits an empty list`() = runTest {
val timelineItems: MutableSharedFlow<List<MatrixTimelineItem>> =
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 {
val timelineItems: MutableSharedFlow<List<MatrixTimelineItem>> =
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 {
val timelineItems: MutableSharedFlow<List<MatrixTimelineItem>> =
MutableSharedFlow(replay = 1, extraBufferCapacity = Int.MAX_VALUE)
@ -104,7 +104,7 @@ class TimelineItemsSubscriberTest {
}
}
@Test
@Test
fun `multiple subscriptions does not have side effect`() = runTest {
val timelineItemsSubscriber = createTimelineItemsSubscriber()
timelineItemsSubscriber.subscribeIfNeeded()