Restore disabled tests with FFI fakes

This commit is contained in:
Jorge Martín 2025-12-04 16:55:22 +01:00
parent e6a681899e
commit 89149a4268
24 changed files with 49 additions and 136 deletions

View file

@ -23,11 +23,9 @@ import io.element.android.services.toolbox.test.systemclock.FakeSystemClock
import io.element.android.tests.testutils.testCoroutineDispatchers
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
import java.io.File
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
class RustMatrixClientFactoryTest {
@Test
fun test() = runTest {

View file

@ -31,13 +31,11 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
import org.matrix.rustcomponents.sdk.Client
import org.matrix.rustcomponents.sdk.UserProfile
import java.io.File
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
class RustMatrixClientTest {
@Test
fun `ensure that sessionId and deviceId can be retrieved from the client`() = runTest {

View file

@ -11,10 +11,8 @@ package io.element.android.libraries.matrix.impl.auth
import com.google.common.truth.Truth.assertThat
import io.element.android.libraries.matrix.api.auth.MatrixHomeServerDetails
import io.element.android.libraries.matrix.impl.fixtures.fakes.FakeFfiHomeserverLoginDetails
import org.junit.Ignore
import org.junit.Test
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
class HomeserverDetailsKtTest {
@Test
fun `map should be correct`() {

View file

@ -14,10 +14,8 @@ import io.element.android.libraries.matrix.impl.fixtures.fakes.FakeFfiClient
import io.element.android.libraries.matrix.impl.fixtures.fakes.FakeFfiClientBuilder
import io.element.android.libraries.matrix.impl.fixtures.fakes.FakeFfiHomeserverLoginDetails
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
class RustHomeserverLoginCompatibilityCheckerTest {
@Test
fun `check - is valid if it supports OIDC login`() = runTest {

View file

@ -23,13 +23,11 @@ import io.element.android.libraries.sessionstorage.test.InMemorySessionStore
import io.element.android.tests.testutils.testCoroutineDispatchers
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
import java.io.File
class RustMatrixAuthenticationServiceTest {
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `setHomeserver is successful`() = runTest {
val sut = createRustMatrixAuthenticationService(
clientBuilderProvider = FakeClientBuilderProvider(

View file

@ -11,10 +11,8 @@ package io.element.android.libraries.matrix.impl.auth.qrlogin
import com.google.common.truth.Truth.assertThat
import io.element.android.libraries.matrix.impl.fixtures.fakes.FakeFfiQrCodeData
import io.element.android.libraries.matrix.test.A_HOMESERVER_URL
import org.junit.Ignore
import org.junit.Test
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
class SdkQrCodeLoginDataTest {
@Test
fun `getServer reads the value from the Rust side, null case`() {

View file

@ -29,15 +29,13 @@ import io.element.android.tests.testutils.lambda.lambdaRecorder
import io.element.android.tests.testutils.testCoroutineDispatchers
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
import org.matrix.rustcomponents.sdk.NotificationClient
import org.matrix.rustcomponents.sdk.NotificationStatus
import org.matrix.rustcomponents.sdk.TimelineEventType
class RustNotificationServiceTest {
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun test() = runTest {
val notificationClient = FakeFfiNotificationClient(
notificationItemResult = mapOf(AN_EVENT_ID.value to aRustBatchNotificationResult()),
@ -58,8 +56,7 @@ class RustNotificationServiceTest {
)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@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() {
@ -86,8 +83,7 @@ class RustNotificationServiceTest {
assertThat(successfulResult?.isSuccess).isTrue()
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `test unable to resolve event`() = runTest {
val notificationClient = FakeFfiNotificationClient(
notificationItemResult = emptyMap(),
@ -99,8 +95,7 @@ class RustNotificationServiceTest {
assertThat(exception).isInstanceOf(NotificationResolverException::class.java)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `close should invoke the close method of the service`() = runTest {
val closeResult = lambdaRecorder<Unit> { }
val notificationClient = FakeFfiNotificationClient(

View file

@ -16,13 +16,11 @@ import io.element.android.libraries.matrix.test.A_ROOM_ID
import io.element.android.tests.testutils.testCoroutineDispatchers
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
import org.matrix.rustcomponents.sdk.NotificationSettings
class RustNotificationSettingsServiceTest {
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun test() = runTest {
val sut = createRustNotificationSettingsService()
val result = sut.getRoomNotificationSettings(

View file

@ -13,10 +13,8 @@ import io.element.android.libraries.matrix.api.pusher.UnsetHttpPusherData
import io.element.android.libraries.matrix.impl.fixtures.fakes.FakeFfiClient
import io.element.android.tests.testutils.testCoroutineDispatchers
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
class RustPushersServiceTest {
@Test
fun `setPusher should invoke the client method`() = runTest {

View file

@ -14,10 +14,8 @@ import io.element.android.libraries.matrix.api.user.MatrixUser
import io.element.android.libraries.matrix.impl.fixtures.factories.aRustRoomHero
import io.element.android.libraries.matrix.impl.fixtures.factories.aRustRoomInfo
import io.element.android.libraries.matrix.test.A_USER_ID
import org.junit.Ignore
import org.junit.Test
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
class RoomInfoExtTest {
@Test
fun `get non empty element Heroes`() {

View file

@ -32,7 +32,6 @@ import io.element.android.libraries.matrix.test.room.defaultRoomPowerLevelValues
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.persistentMapOf
import kotlinx.collections.immutable.toImmutableList
import org.junit.Ignore
import org.junit.Test
import org.matrix.rustcomponents.sdk.Membership
import uniffi.matrix_sdk_base.EncryptionState
@ -40,7 +39,6 @@ import org.matrix.rustcomponents.sdk.JoinRule as RustJoinRule
import org.matrix.rustcomponents.sdk.RoomHistoryVisibility as RustRoomHistoryVisibility
import org.matrix.rustcomponents.sdk.RoomNotificationMode as RustRoomNotificationMode
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
class RoomInfoMapperTest {
@Test
fun `mapping of RustRoomInfo should map all the fields`() {

View file

@ -31,11 +31,9 @@ import kotlinx.coroutines.flow.shareIn
import kotlinx.coroutines.isActive
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
import uniffi.matrix_sdk.RoomMemberRole
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
class RustBaseRoomTest {
@Test
fun `RustBaseRoom should cancel the room coroutine scope when it is destroyed`() = runTest {

View file

@ -25,10 +25,8 @@ import io.element.android.services.analytics.test.FakeAnalyticsService
import io.element.android.tests.testutils.lambda.lambdaRecorder
import io.element.android.tests.testutils.lambda.value
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
class DefaultJoinRoomTest {
@Test
fun `when using roomId and there is no server names, the classic join room API is used`() = runTest {

View file

@ -24,10 +24,8 @@ import io.element.android.libraries.matrix.test.A_USER_ID_3
import io.element.android.libraries.matrix.test.A_USER_ID_4
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
class RoomMemberListFetcherTest {
@Test
fun `fetchRoomMembers with CACHE source - emits cached members, if any`() = runTest {

View file

@ -19,12 +19,10 @@ import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
import org.matrix.rustcomponents.sdk.RoomDirectorySearch
import org.matrix.rustcomponents.sdk.RoomDirectorySearchEntryUpdate
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@OptIn(ExperimentalCoroutinesApi::class)
class RustBaseRoomDirectoryListTest {
@Test

View file

@ -11,12 +11,10 @@ package io.element.android.libraries.matrix.impl.roomdirectory
import io.element.android.libraries.matrix.impl.fixtures.fakes.FakeFfiClient
import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
class RustBaseRoomDirectoryServiceTest {
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun test() = runTest {
val client = FakeFfiClient()
val sut = RustRoomDirectoryService(

View file

@ -12,13 +12,11 @@ import io.element.android.libraries.matrix.impl.fixtures.fakes.FakeFfiRoomList
import io.element.android.libraries.matrix.impl.fixtures.fakes.FakeFfiRoomListService
import io.element.android.services.analytics.test.FakeAnalyticsService
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
import kotlin.coroutines.EmptyCoroutineContext
class RoomListFactoryTest {
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `createRoomList should work`() = runTest {
val sut = RoomListFactory(
innerRoomListService = FakeFfiRoomListService(),

View file

@ -21,15 +21,13 @@ import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
import org.matrix.rustcomponents.sdk.RoomListEntriesUpdate
class RoomSummaryListProcessorTest {
private val summaries = MutableStateFlow<List<RoomSummary>>(emptyList())
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Append adds new entries at the end of the list`() = runTest {
summaries.value = listOf(aRoomSummary())
val processor = createProcessor()
@ -41,8 +39,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value.subList(1, 4).all { it.roomId == A_ROOM_ID_2 }).isTrue()
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `PushBack adds a new entry at the end of the list`() = runTest {
summaries.value = listOf(aRoomSummary())
val processor = createProcessor()
@ -52,8 +49,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value.last().roomId).isEqualTo(A_ROOM_ID_2)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `PushFront inserts a new entry at the start of the list`() = runTest {
summaries.value = listOf(aRoomSummary())
val processor = createProcessor()
@ -63,8 +59,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value.first().roomId).isEqualTo(A_ROOM_ID_2)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Set replaces an entry at some index`() = runTest {
summaries.value = listOf(aRoomSummary())
val processor = createProcessor()
@ -76,8 +71,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID_2)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Insert inserts a new entry at the provided index`() = runTest {
summaries.value = listOf(aRoomSummary())
val processor = createProcessor()
@ -89,8 +83,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID_2)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Remove removes an entry at some index`() = runTest {
summaries.value = listOf(
aRoomSummary(roomId = A_ROOM_ID),
@ -105,8 +98,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID_2)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `PopBack removes an entry at the end of the list`() = runTest {
summaries.value = listOf(
aRoomSummary(roomId = A_ROOM_ID),
@ -121,8 +113,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `PopFront removes an entry at the start of the list`() = runTest {
summaries.value = listOf(
aRoomSummary(roomId = A_ROOM_ID),
@ -137,8 +128,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID_2)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Clear removes all the entries`() = runTest {
summaries.value = listOf(
aRoomSummary(roomId = A_ROOM_ID),
@ -151,8 +141,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value).isEmpty()
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Truncate removes all entries after the provided length`() = runTest {
summaries.value = listOf(
aRoomSummary(roomId = A_ROOM_ID),
@ -167,8 +156,7 @@ class RoomSummaryListProcessorTest {
assertThat(summaries.value[index].roomId).isEqualTo(A_ROOM_ID)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Reset removes all entries and add the provided ones`() = runTest {
summaries.value = listOf(
aRoomSummary(roomId = A_ROOM_ID),

View file

@ -19,12 +19,10 @@ import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
import org.matrix.rustcomponents.sdk.RoomListServiceSyncIndicator
import org.matrix.rustcomponents.sdk.RoomListService as RustRoomListService
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@OptIn(ExperimentalCoroutinesApi::class)
class RustBaseRoomListServiceTest {
@Test

View file

@ -18,15 +18,13 @@ import io.element.android.libraries.previewutils.room.aSpaceRoom
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
import org.matrix.rustcomponents.sdk.SpaceListUpdate
class RoomSummaryListProcessorTest {
private val spaceRoomsFlow = MutableStateFlow<List<SpaceRoom>>(emptyList())
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Append adds new entries at the end of the list`() = runTest {
spaceRoomsFlow.value = listOf(aSpaceRoom())
val processor = createProcessor()
@ -38,8 +36,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value.subList(1, 4).all { it.roomId == A_ROOM_ID_2 }).isTrue()
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `PushBack adds a new entry at the end of the list`() = runTest {
spaceRoomsFlow.value = listOf(aSpaceRoom())
val processor = createProcessor()
@ -49,8 +46,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value.last().roomId).isEqualTo(A_ROOM_ID_2)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `PushFront inserts a new entry at the start of the list`() = runTest {
spaceRoomsFlow.value = listOf(aSpaceRoom())
val processor = createProcessor()
@ -60,8 +56,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value.first().roomId).isEqualTo(A_ROOM_ID_2)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Set replaces an entry at some index`() = runTest {
spaceRoomsFlow.value = listOf(aSpaceRoom())
val processor = createProcessor()
@ -73,8 +68,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_2)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Insert inserts a new entry at the provided index`() = runTest {
spaceRoomsFlow.value = listOf(aSpaceRoom())
val processor = createProcessor()
@ -86,8 +80,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_2)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Remove removes an entry at some index`() = runTest {
spaceRoomsFlow.value = listOf(
aSpaceRoom(roomId = A_ROOM_ID),
@ -102,8 +95,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_2)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `PopBack removes an entry at the end of the list`() = runTest {
spaceRoomsFlow.value = listOf(
aSpaceRoom(roomId = A_ROOM_ID),
@ -118,8 +110,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `PopFront removes an entry at the start of the list`() = runTest {
spaceRoomsFlow.value = listOf(
aSpaceRoom(roomId = A_ROOM_ID),
@ -134,8 +125,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_2)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Clear removes all the entries`() = runTest {
spaceRoomsFlow.value = listOf(
aSpaceRoom(roomId = A_ROOM_ID),
@ -148,8 +138,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value).isEmpty()
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Truncate removes all entries after the provided length`() = runTest {
spaceRoomsFlow.value = listOf(
aSpaceRoom(roomId = A_ROOM_ID),
@ -164,8 +153,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Reset removes all entries and add the provided ones`() = runTest {
spaceRoomsFlow.value = listOf(
aSpaceRoom(roomId = A_ROOM_ID),
@ -180,8 +168,7 @@ class RoomSummaryListProcessorTest {
assertThat(spaceRoomsFlow.value[index].roomId).isEqualTo(A_ROOM_ID_3)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@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

@ -23,15 +23,13 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
import org.matrix.rustcomponents.sdk.SpaceListUpdate
import uniffi.matrix_sdk_ui.SpaceRoomListPaginationState
import org.matrix.rustcomponents.sdk.SpaceRoomList as InnerSpaceRoomList
class RustSpaceRoomListTest {
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `paginationStatusFlow emits values`() = runTest {
val innerSpaceRoomList = FakeFfiSpaceRoomList(
paginationStateResult = { SpaceRoomListPaginationState.Idle(false) }
@ -53,8 +51,7 @@ class RustSpaceRoomListTest {
}
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `spaceRoomsFlow emits values`() = runTest {
val innerSpaceRoomList = FakeFfiSpaceRoomList(
paginationStateResult = { SpaceRoomListPaginationState.Idle(false) }
@ -76,8 +73,7 @@ class RustSpaceRoomListTest {
}
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `paginate invokes paginate on the inner class`() = runTest {
val paginateResult = lambdaRecorder<Unit> { }
val innerSpaceRoomList = FakeFfiSpaceRoomList(

View file

@ -21,7 +21,6 @@ import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
import org.matrix.rustcomponents.sdk.TimelineDiff
@ -31,8 +30,7 @@ class MatrixTimelineDiffProcessorTest {
private val anEvent = MatrixTimelineItem.Event(A_UNIQUE_ID, anEventTimelineItem())
private val anEvent2 = MatrixTimelineItem.Event(A_UNIQUE_ID_2, anEventTimelineItem())
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Append adds new entries at the end of the list`() = runTest {
timelineItems.value = listOf(anEvent)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -44,8 +42,7 @@ class MatrixTimelineDiffProcessorTest {
)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `PushBack adds a new entry at the end of the list`() = runTest {
timelineItems.value = listOf(anEvent)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -57,8 +54,7 @@ class MatrixTimelineDiffProcessorTest {
)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `PushFront inserts a new entry at the start of the list`() = runTest {
timelineItems.value = listOf(anEvent)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -70,8 +66,7 @@ class MatrixTimelineDiffProcessorTest {
)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Set replaces an entry at some index`() = runTest {
timelineItems.value = listOf(anEvent, anEvent2)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -83,8 +78,7 @@ class MatrixTimelineDiffProcessorTest {
)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Insert inserts a new entry at the provided index`() = runTest {
timelineItems.value = listOf(anEvent, anEvent2)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -97,8 +91,7 @@ class MatrixTimelineDiffProcessorTest {
)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Remove removes an entry at some index`() = runTest {
timelineItems.value = listOf(anEvent, MatrixTimelineItem.Other, anEvent2)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -110,8 +103,7 @@ class MatrixTimelineDiffProcessorTest {
)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `PopBack removes an entry at the end of the list`() = runTest {
timelineItems.value = listOf(anEvent, anEvent2)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -122,8 +114,7 @@ class MatrixTimelineDiffProcessorTest {
)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `PopFront removes an entry at the start of the list`() = runTest {
timelineItems.value = listOf(anEvent, anEvent2)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -134,8 +125,7 @@ class MatrixTimelineDiffProcessorTest {
)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Clear removes all the entries`() = runTest {
timelineItems.value = listOf(anEvent, anEvent2)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -143,8 +133,7 @@ class MatrixTimelineDiffProcessorTest {
assertThat(timelineItems.value).isEmpty()
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `Truncate removes all entries after the provided length`() = runTest {
timelineItems.value = listOf(anEvent, MatrixTimelineItem.Other, anEvent2)
val processor = createMatrixTimelineDiffProcessor(timelineItems)
@ -155,8 +144,7 @@ class MatrixTimelineDiffProcessorTest {
)
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@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

@ -30,13 +30,11 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
import org.matrix.rustcomponents.sdk.TimelineDiff
import uniffi.matrix_sdk.RoomPaginationStatus
import org.matrix.rustcomponents.sdk.Timeline as InnerTimeline
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
class RustTimelineTest {
@Test
fun `ensure that the timeline emits new loading item when pagination does not bring new events`() = runTest {

View file

@ -20,7 +20,6 @@ import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Ignore
import org.junit.Test
import org.matrix.rustcomponents.sdk.Timeline
import org.matrix.rustcomponents.sdk.TimelineDiff
@ -28,8 +27,7 @@ import uniffi.matrix_sdk_ui.EventItemOrigin
@OptIn(ExperimentalCoroutinesApi::class)
class TimelineItemsSubscriberTest {
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@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)
@ -52,8 +50,7 @@ class TimelineItemsSubscriberTest {
}
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@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)
@ -76,8 +73,7 @@ class TimelineItemsSubscriberTest {
}
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `when timeline emits an item with SYNC origin`() = runTest {
val timelineItems: MutableSharedFlow<List<MatrixTimelineItem>> =
MutableSharedFlow(replay = 1, extraBufferCapacity = Int.MAX_VALUE)
@ -108,8 +104,7 @@ class TimelineItemsSubscriberTest {
}
}
@Ignore("JNA direct mapping has broken unit tests with FFI fakes")
@Test
@Test
fun `multiple subscriptions does not have side effect`() = runTest {
val timelineItemsSubscriber = createTimelineItemsSubscriber()
timelineItemsSubscriber.subscribeIfNeeded()