Merge pull request #2948 from element-hq/feature/bma/konsistUpgrade
Konsist upgrade
This commit is contained in:
commit
155fd4ab81
51 changed files with 66 additions and 45 deletions
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package io.element.android.appnav.room.joined
|
package io.element.android.appnav.room.joined
|
||||||
|
|
||||||
|
import androidx.compose.runtime.Immutable
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||||
import io.element.android.libraries.di.SessionScope
|
import io.element.android.libraries.di.SessionScope
|
||||||
import io.element.android.libraries.di.SingleIn
|
import io.element.android.libraries.di.SingleIn
|
||||||
|
|
@ -31,6 +32,7 @@ import kotlinx.coroutines.flow.map
|
||||||
import kotlinx.coroutines.flow.stateIn
|
import kotlinx.coroutines.flow.stateIn
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@Immutable
|
||||||
sealed interface LoadingRoomState {
|
sealed interface LoadingRoomState {
|
||||||
data object Loading : LoadingRoomState
|
data object Loading : LoadingRoomState
|
||||||
data object Error : LoadingRoomState
|
data object Error : LoadingRoomState
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class AnalyticsVerificationStateMappingTests {
|
class AnalyticsVerificationStateMappingTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -31,7 +31,7 @@ import io.element.android.services.analytics.test.FakeAnalyticsService
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class DefaultStartDMActionTests {
|
class DefaultStartDMActionTest {
|
||||||
@Test
|
@Test
|
||||||
fun `when dm is found, assert state is updated with given room id`() = runTest {
|
fun `when dm is found, assert state is updated with given room id`() = runTest {
|
||||||
val matrixClient = FakeMatrixClient().apply {
|
val matrixClient = FakeMatrixClient().apply {
|
||||||
|
|
@ -30,7 +30,7 @@ import org.junit.Before
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class AddPeoplePresenterTests {
|
class AddPeoplePresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -61,7 +61,7 @@ private const val AN_URI_FROM_CAMERA_2 = "content://uri_from_camera_2"
|
||||||
private const val AN_URI_FROM_GALLERY = "content://uri_from_gallery"
|
private const val AN_URI_FROM_GALLERY = "content://uri_from_gallery"
|
||||||
|
|
||||||
@RunWith(RobolectricTestRunner::class)
|
@RunWith(RobolectricTestRunner::class)
|
||||||
class ConfigureRoomPresenterTests {
|
class ConfigureRoomPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class CreateRoomRootPresenterTests {
|
class CreateRoomRootPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class DefaultUserListPresenterTests {
|
class DefaultUserListPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@ import kotlinx.coroutines.cancel
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class DefaultFtueServiceTests {
|
class DefaultFtueServiceTest {
|
||||||
@Test
|
@Test
|
||||||
fun `given any check being false and session verification state being loaded, FtueState is Incomplete`() = runTest {
|
fun `given any check being false and session verification state being loaded, FtueState is Incomplete`() = runTest {
|
||||||
val sessionVerificationService = FakeSessionVerificationService().apply {
|
val sessionVerificationService = FakeSessionVerificationService().apply {
|
||||||
|
|
@ -38,7 +38,7 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class NotificationsOptInPresenterTests {
|
class NotificationsOptInPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -42,6 +42,7 @@ data class JoinRoomState(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Immutable
|
||||||
sealed interface ContentState {
|
sealed interface ContentState {
|
||||||
data class Loading(val roomIdOrAlias: RoomIdOrAlias) : ContentState
|
data class Loading(val roomIdOrAlias: RoomIdOrAlias) : ContentState
|
||||||
data class Failure(val roomIdOrAlias: RoomIdOrAlias, val error: Throwable) : ContentState
|
data class Failure(val roomIdOrAlias: RoomIdOrAlias, val error: Throwable) : ContentState
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package io.element.android.features.messages.impl.attachments.preview
|
package io.element.android.features.messages.impl.attachments.preview
|
||||||
|
|
||||||
|
import androidx.compose.runtime.Immutable
|
||||||
import io.element.android.features.messages.impl.attachments.Attachment
|
import io.element.android.features.messages.impl.attachments.Attachment
|
||||||
|
|
||||||
data class AttachmentsPreviewState(
|
data class AttachmentsPreviewState(
|
||||||
|
|
@ -24,8 +25,11 @@ data class AttachmentsPreviewState(
|
||||||
val eventSink: (AttachmentsPreviewEvents) -> Unit
|
val eventSink: (AttachmentsPreviewEvents) -> Unit
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Immutable
|
||||||
sealed interface SendActionState {
|
sealed interface SendActionState {
|
||||||
data object Idle : SendActionState
|
data object Idle : SendActionState
|
||||||
|
|
||||||
|
@Immutable
|
||||||
sealed interface Sending : SendActionState {
|
sealed interface Sending : SendActionState {
|
||||||
data object Processing : Sending
|
data object Processing : Sending
|
||||||
data class Uploading(val progress: Float) : Sending
|
data class Uploading(val progress: Float) : Sending
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,10 @@
|
||||||
|
|
||||||
package io.element.android.features.messages.impl.sender
|
package io.element.android.features.messages.impl.sender
|
||||||
|
|
||||||
|
import androidx.compose.runtime.Immutable
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
@Immutable
|
||||||
sealed interface SenderNameMode {
|
sealed interface SenderNameMode {
|
||||||
data class Timeline(val mainColor: Color) : SenderNameMode
|
data class Timeline(val mainColor: Color) : SenderNameMode
|
||||||
data object Reply : SenderNameMode
|
data object Reply : SenderNameMode
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.lang.IllegalStateException
|
import java.lang.IllegalStateException
|
||||||
|
|
||||||
class ForwardMessagesPresenterTests {
|
class ForwardMessagesPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -31,7 +31,7 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class ReportMessagePresenterTests {
|
class ReportMessagePresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -28,7 +28,7 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class CustomReactionPresenterTests {
|
class CustomReactionPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -34,7 +34,7 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class ReactionSummaryPresenterTests {
|
class ReactionSummaryPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -26,7 +26,7 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class ReadReceiptBottomSheetPresenterTests {
|
class ReadReceiptBottomSheetPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -28,7 +28,7 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class RetrySendMenuPresenterTests {
|
class RetrySendMenuPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ import kotlinx.collections.immutable.persistentListOf
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class BlockedUsersPresenterTests {
|
class BlockedUsersPresenterTest {
|
||||||
@Test
|
@Test
|
||||||
fun `present - initial state with no blocked users`() = runTest {
|
fun `present - initial state with no blocked users`() = runTest {
|
||||||
val presenter = aBlockedUsersPresenter()
|
val presenter = aBlockedUsersPresenter()
|
||||||
|
|
@ -36,7 +36,7 @@ import io.element.android.tests.testutils.consumeItemsUntilPredicate
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class EditDefaultNotificationSettingsPresenterTests {
|
class EditDefaultNotificationSettingsPresenterTest {
|
||||||
@Test
|
@Test
|
||||||
fun `present - ensures initial state is correct`() = runTest {
|
fun `present - ensures initial state is correct`() = runTest {
|
||||||
val notificationSettingsService = FakeNotificationSettingsService()
|
val notificationSettingsService = FakeNotificationSettingsService()
|
||||||
|
|
@ -38,7 +38,7 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import kotlin.time.Duration.Companion.milliseconds
|
import kotlin.time.Duration.Companion.milliseconds
|
||||||
|
|
||||||
class NotificationSettingsPresenterTests {
|
class NotificationSettingsPresenterTest {
|
||||||
@Test
|
@Test
|
||||||
fun `present - ensures initial state is correct`() = runTest {
|
fun `present - ensures initial state is correct`() = runTest {
|
||||||
val presenter = createNotificationSettingsPresenter()
|
val presenter = createNotificationSettingsPresenter()
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package io.element.android.features.roomdetails.impl
|
package io.element.android.features.roomdetails.impl
|
||||||
|
|
||||||
|
import androidx.compose.runtime.Immutable
|
||||||
import io.element.android.features.leaveroom.api.LeaveRoomState
|
import io.element.android.features.leaveroom.api.LeaveRoomState
|
||||||
import io.element.android.features.userprofile.shared.UserProfileState
|
import io.element.android.features.userprofile.shared.UserProfileState
|
||||||
import io.element.android.libraries.matrix.api.core.RoomAlias
|
import io.element.android.libraries.matrix.api.core.RoomAlias
|
||||||
|
|
@ -45,11 +46,13 @@ data class RoomDetailsState(
|
||||||
val eventSink: (RoomDetailsEvent) -> Unit
|
val eventSink: (RoomDetailsEvent) -> Unit
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Immutable
|
||||||
sealed interface RoomDetailsType {
|
sealed interface RoomDetailsType {
|
||||||
data object Room : RoomDetailsType
|
data object Room : RoomDetailsType
|
||||||
data class Dm(val roomMember: RoomMember) : RoomDetailsType
|
data class Dm(val roomMember: RoomMember) : RoomDetailsType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Immutable
|
||||||
sealed interface RoomTopicState {
|
sealed interface RoomTopicState {
|
||||||
data object Hidden : RoomTopicState
|
data object Hidden : RoomTopicState
|
||||||
data object CanAddTopic : RoomTopicState
|
data object CanAddTopic : RoomTopicState
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ import org.junit.Test
|
||||||
import kotlin.time.Duration.Companion.milliseconds
|
import kotlin.time.Duration.Companion.milliseconds
|
||||||
|
|
||||||
@ExperimentalCoroutinesApi
|
@ExperimentalCoroutinesApi
|
||||||
class RoomDetailsPresenterTests {
|
class RoomDetailsPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@ExperimentalCoroutinesApi
|
@ExperimentalCoroutinesApi
|
||||||
class RoomMemberListPresenterTests {
|
class RoomMemberListPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@ExperimentalCoroutinesApi
|
@ExperimentalCoroutinesApi
|
||||||
class RoomMemberDetailsPresenterTests {
|
class RoomMemberDetailsPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ import kotlinx.coroutines.test.TestScope
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class DefaultRoomMembersModerationPresenterTests {
|
class DefaultRoomMembersModerationPresenterTest {
|
||||||
@Test
|
@Test
|
||||||
fun `canDisplayModerationActions - when room is DM is false`() = runTest {
|
fun `canDisplayModerationActions - when room is DM is false`() = runTest {
|
||||||
val room = FakeMatrixRoom(isDirect = true, isPublic = true, isOneToOne = true).apply {
|
val room = FakeMatrixRoom(isDirect = true, isPublic = true, isOneToOne = true).apply {
|
||||||
|
|
@ -33,7 +33,7 @@ import io.element.android.tests.testutils.consumeItemsUntilPredicate
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class RoomNotificationSettingsPresenterTests {
|
class RoomNotificationSettingsPresenterTest {
|
||||||
@Test
|
@Test
|
||||||
fun `present - initial state is created from room info`() = runTest {
|
fun `present - initial state is created from room info`() = runTest {
|
||||||
val presenter = createRoomNotificationSettingsPresenter()
|
val presenter = createRoomNotificationSettingsPresenter()
|
||||||
|
|
@ -36,7 +36,7 @@ import kotlinx.coroutines.test.runCurrent
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class RolesAndPermissionPresenterTests {
|
class RolesAndPermissionPresenterTest {
|
||||||
@Test
|
@Test
|
||||||
fun `present - initial state`() = runTest {
|
fun `present - initial state`() = runTest {
|
||||||
val presenter = createRolesAndPermissionsPresenter()
|
val presenter = createRolesAndPermissionsPresenter()
|
||||||
|
|
@ -43,7 +43,7 @@ import org.junit.runner.RunWith
|
||||||
import org.robolectric.annotation.Config
|
import org.robolectric.annotation.Config
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
class RolesAndPermissionsViewTests {
|
class RolesAndPermissionsViewTest {
|
||||||
@get:Rule val rule = createAndroidComposeRule<ComponentActivity>()
|
@get:Rule val rule = createAndroidComposeRule<ComponentActivity>()
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -42,7 +42,7 @@ import kotlinx.coroutines.test.TestScope
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class ChangeRolesPresenterTests {
|
class ChangeRolesPresenterTest {
|
||||||
@Test
|
@Test
|
||||||
fun `present - initial state`() = runTest {
|
fun `present - initial state`() = runTest {
|
||||||
val presenter = createChangeRolesPresenter()
|
val presenter = createChangeRolesPresenter()
|
||||||
|
|
@ -39,7 +39,7 @@ import io.element.android.services.analytics.test.FakeAnalyticsService
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class ChangeRoomPermissionsPresenterTests {
|
class ChangeRoomPermissionsPresenterTest {
|
||||||
@Test
|
@Test
|
||||||
fun `present - initial state`() = runTest {
|
fun `present - initial state`() = runTest {
|
||||||
val section = ChangeRoomPermissionsSection.RoomDetails
|
val section = ChangeRoomPermissionsSection.RoomDetails
|
||||||
|
|
@ -46,7 +46,7 @@ import org.junit.rules.TestRule
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
class ChangeRoomPermissionsViewTests {
|
class ChangeRoomPermissionsViewTest {
|
||||||
@get:Rule val rule = createAndroidComposeRule<ComponentActivity>()
|
@get:Rule val rule = createAndroidComposeRule<ComponentActivity>()
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -92,7 +92,7 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class RoomListPresenterTests {
|
class RoomListPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -29,7 +29,7 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import io.element.android.libraries.matrix.api.roomlist.RoomListFilter as MatrixRoomListFilter
|
import io.element.android.libraries.matrix.api.roomlist.RoomListFilter as MatrixRoomListFilter
|
||||||
|
|
||||||
class RoomListFiltersPresenterTests {
|
class RoomListFiltersPresenterTest {
|
||||||
@Test
|
@Test
|
||||||
fun `present - initial state`() = runTest {
|
fun `present - initial state`() = runTest {
|
||||||
val presenter = createRoomListFiltersPresenter()
|
val presenter = createRoomListFiltersPresenter()
|
||||||
|
|
@ -30,7 +30,7 @@ import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
class RoomListFiltersViewTests {
|
class RoomListFiltersViewTest {
|
||||||
@get:Rule val rule = createAndroidComposeRule<ComponentActivity>()
|
@get:Rule val rule = createAndroidComposeRule<ComponentActivity>()
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -36,7 +36,7 @@ import kotlinx.coroutines.test.TestScope
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class RoomListSearchPresenterTests {
|
class RoomListSearchPresenterTest {
|
||||||
@Test
|
@Test
|
||||||
fun `present - initial state`() = runTest {
|
fun `present - initial state`() = runTest {
|
||||||
val presenter = createRoomListSearchPresenter()
|
val presenter = createRoomListSearchPresenter()
|
||||||
|
|
@ -43,7 +43,7 @@ import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@ExperimentalCoroutinesApi
|
@ExperimentalCoroutinesApi
|
||||||
class UserProfilePresenterTests {
|
class UserProfilePresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@ExperimentalCoroutinesApi
|
@ExperimentalCoroutinesApi
|
||||||
class VerifySelfSessionPresenterTests {
|
class VerifySelfSessionPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -134,7 +134,7 @@ test_arch_core = "androidx.arch.core:core-testing:2.2.0"
|
||||||
test_junit = "junit:junit:4.13.2"
|
test_junit = "junit:junit:4.13.2"
|
||||||
test_runner = "androidx.test:runner:1.5.2"
|
test_runner = "androidx.test:runner:1.5.2"
|
||||||
test_mockk = "io.mockk:mockk:1.13.11"
|
test_mockk = "io.mockk:mockk:1.13.11"
|
||||||
test_konsist = "com.lemonappdev:konsist:0.13.0"
|
test_konsist = "com.lemonappdev:konsist:0.15.1"
|
||||||
test_turbine = "app.cash.turbine:turbine:1.1.0"
|
test_turbine = "app.cash.turbine:turbine:1.1.0"
|
||||||
test_truth = "com.google.truth:truth:1.4.2"
|
test_truth = "com.google.truth:truth:1.4.2"
|
||||||
test_parameter_injector = "com.google.testparameterinjector:test-parameter-injector:1.16"
|
test_parameter_injector = "com.google.testparameterinjector:test-parameter-injector:1.16"
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
class AsyncIndicatorTests {
|
class AsyncIndicatorTest {
|
||||||
@Test
|
@Test
|
||||||
fun `initial state`() = runTest {
|
fun `initial state`() = runTest {
|
||||||
val state = AsyncIndicatorState()
|
val state = AsyncIndicatorState()
|
||||||
|
|
@ -21,7 +21,7 @@ import com.google.common.truth.Truth.assertThat
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class SnackbarDispatcherTests {
|
class SnackbarDispatcherTest {
|
||||||
@Test
|
@Test
|
||||||
fun `given an empty queue the flow emits a null item`() = runTest {
|
fun `given an empty queue the flow emits a null item`() = runTest {
|
||||||
val snackbarDispatcher = SnackbarDispatcher()
|
val snackbarDispatcher = SnackbarDispatcher()
|
||||||
|
|
@ -17,8 +17,10 @@
|
||||||
package io.element.android.libraries.matrix.api.core
|
package io.element.android.libraries.matrix.api.core
|
||||||
|
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
|
import androidx.compose.runtime.Immutable
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
|
|
||||||
|
@Immutable
|
||||||
sealed interface RoomIdOrAlias : Parcelable {
|
sealed interface RoomIdOrAlias : Parcelable {
|
||||||
@Parcelize
|
@Parcelize
|
||||||
@JvmInline
|
@JvmInline
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import io.element.android.libraries.matrix.test.room.aRoomSummaryFilled
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class RoomListFilterTests {
|
class RoomListFilterTest {
|
||||||
private val regularRoom = aRoomSummaryFilled(
|
private val regularRoom = aRoomSummaryFilled(
|
||||||
aRoomSummaryDetails(
|
aRoomSummaryDetails(
|
||||||
isDirect = false
|
isDirect = false
|
||||||
|
|
@ -39,7 +39,7 @@ import org.matrix.rustcomponents.sdk.TaskHandle
|
||||||
|
|
||||||
// NOTE: this class is using a fake implementation of a Rust SDK interface which returns actual Rust objects with pointers.
|
// NOTE: this class is using a fake implementation of a Rust SDK interface which returns actual Rust objects with pointers.
|
||||||
// Since we don't access the data in those objects, this is fine for our tests, but that's as far as we can test this class.
|
// Since we don't access the data in those objects, this is fine for our tests, but that's as far as we can test this class.
|
||||||
class RoomSummaryListProcessorTests {
|
class RoomSummaryListProcessorTest {
|
||||||
private val summaries = MutableStateFlow<List<RoomSummary>>(emptyList())
|
private val summaries = MutableStateFlow<List<RoomSummary>>(emptyList())
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -32,7 +32,7 @@ import org.junit.runner.RunWith
|
||||||
import org.robolectric.RobolectricTestRunner
|
import org.robolectric.RobolectricTestRunner
|
||||||
|
|
||||||
@RunWith(RobolectricTestRunner::class)
|
@RunWith(RobolectricTestRunner::class)
|
||||||
class MediaSenderTests {
|
class MediaSenderTest {
|
||||||
@Test
|
@Test
|
||||||
fun `given an attachment when sending it the preprocessor always runs`() = runTest {
|
fun `given an attachment when sending it the preprocessor always runs`() = runTest {
|
||||||
val preProcessor = FakeMediaPreProcessor()
|
val preProcessor = FakeMediaPreProcessor()
|
||||||
|
|
@ -32,7 +32,7 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class RoomSelectPresenterTests {
|
class RoomSelectPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
@ -28,7 +28,7 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class DatabaseSessionStoreTests {
|
class DatabaseSessionStoreTest {
|
||||||
private lateinit var database: SessionDatabase
|
private lateinit var database: SessionDatabase
|
||||||
private lateinit var databaseSessionStore: DatabaseSessionStore
|
private lateinit var databaseSessionStore: DatabaseSessionStore
|
||||||
|
|
||||||
|
|
@ -28,7 +28,7 @@ import io.element.android.services.analytics.test.FakeAnalyticsService
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class TroubleshootNotificationsPresenterTests {
|
class TroubleshootNotificationsPresenterTest {
|
||||||
@Test
|
@Test
|
||||||
fun `present - initial state`() = runTest {
|
fun `present - initial state`() = runTest {
|
||||||
val presenter = createTroubleshootNotificationsPresenter()
|
val presenter = createTroubleshootNotificationsPresenter()
|
||||||
|
|
@ -87,7 +87,13 @@ class KonsistArchitectureTest {
|
||||||
.withAnnotationOf(Composable::class)
|
.withAnnotationOf(Composable::class)
|
||||||
.assertTrue(additionalMessage = "Consider adding the @Immutable or @Stable annotation to the sealed interface") {
|
.assertTrue(additionalMessage = "Consider adding the @Immutable or @Stable annotation to the sealed interface") {
|
||||||
it.parameters.all { param ->
|
it.parameters.all { param ->
|
||||||
param.type.fullyQualifiedName !in forbiddenInterfacesForComposableParameter
|
val type = param.type.text
|
||||||
|
return@all if (type.startsWith("@") || type.startsWith("(") || type.startsWith("suspend")) {
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
val fullyQualifiedName = param.type.declaration.packagee?.fullyQualifiedName + "." + type
|
||||||
|
fullyQualifiedName !in forbiddenInterfacesForComposableParameter
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ class KonsistClassNameTest {
|
||||||
.assertTrue {
|
.assertTrue {
|
||||||
val interfaceName = it.name.replace("Fake", "")
|
val interfaceName = it.name.replace("Fake", "")
|
||||||
it.name.startsWith("Fake") &&
|
it.name.startsWith("Fake") &&
|
||||||
it.parents.any { parent -> parent.name.replace(".", "") == interfaceName }
|
it.parents().any { parent -> parent.name.replace(".", "") == interfaceName }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,11 @@ import org.junit.Test
|
||||||
|
|
||||||
class KonsistTestTest {
|
class KonsistTestTest {
|
||||||
@Test
|
@Test
|
||||||
fun `Classes name containing @Test must end with 'Test''`() {
|
fun `Classes name containing @Test must end with 'Test'`() {
|
||||||
Konsist
|
Konsist
|
||||||
.scopeFromTest()
|
.scopeFromTest()
|
||||||
.classes()
|
.classes()
|
||||||
|
.withoutName("S", "T")
|
||||||
.withFunction { it.hasAnnotationOf(Test::class) }
|
.withFunction { it.hasAnnotationOf(Test::class) }
|
||||||
.assertTrue { it.name.endsWith("Test") }
|
.assertTrue { it.name.endsWith("Test") }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue