Skip to content

Konsist upgrade #2948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.element.android.appnav.room.joined

import androidx.compose.runtime.Immutable
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import io.element.android.libraries.di.SessionScope
import io.element.android.libraries.di.SingleIn
Expand All @@ -31,6 +32,7 @@ import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
import javax.inject.Inject

@Immutable
sealed interface LoadingRoomState {
data object Loading : LoadingRoomState
data object Error : LoadingRoomState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test

class AnalyticsVerificationStateMappingTests {
class AnalyticsVerificationStateMappingTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import io.element.android.services.analytics.test.FakeAnalyticsService
import kotlinx.coroutines.test.runTest
import org.junit.Test

class DefaultStartDMActionTests {
class DefaultStartDMActionTest {
@Test
fun `when dm is found, assert state is updated with given room id`() = runTest {
val matrixClient = FakeMatrixClient().apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import org.junit.Before
import org.junit.Rule
import org.junit.Test

class AddPeoplePresenterTests {
class AddPeoplePresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

@RunWith(RobolectricTestRunner::class)
class ConfigureRoomPresenterTests {
class ConfigureRoomPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test

class CreateRoomRootPresenterTests {
class CreateRoomRootPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test

class DefaultUserListPresenterTests {
class DefaultUserListPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import kotlinx.coroutines.cancel
import kotlinx.coroutines.test.runTest
import org.junit.Test

class DefaultFtueServiceTests {
class DefaultFtueServiceTest {
@Test
fun `given any check being false and session verification state being loaded, FtueState is Incomplete`() = runTest {
val sessionVerificationService = FakeSessionVerificationService().apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test

class NotificationsOptInPresenterTests {
class NotificationsOptInPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ data class JoinRoomState(
}
}

@Immutable
sealed interface ContentState {
data class Loading(val roomIdOrAlias: RoomIdOrAlias) : ContentState
data class Failure(val roomIdOrAlias: RoomIdOrAlias, val error: Throwable) : ContentState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.element.android.features.messages.impl.attachments.preview

import androidx.compose.runtime.Immutable
import io.element.android.features.messages.impl.attachments.Attachment

data class AttachmentsPreviewState(
Expand All @@ -24,8 +25,11 @@ data class AttachmentsPreviewState(
val eventSink: (AttachmentsPreviewEvents) -> Unit
)

@Immutable
sealed interface SendActionState {
data object Idle : SendActionState

@Immutable
sealed interface Sending : SendActionState {
data object Processing : Sending
data class Uploading(val progress: Float) : Sending
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

package io.element.android.features.messages.impl.sender

import androidx.compose.runtime.Immutable
import androidx.compose.ui.graphics.Color

@Immutable
sealed interface SenderNameMode {
data class Timeline(val mainColor: Color) : SenderNameMode
data object Reply : SenderNameMode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import org.junit.Rule
import org.junit.Test
import java.lang.IllegalStateException

class ForwardMessagesPresenterTests {
class ForwardMessagesPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test

class ReportMessagePresenterTests {
class ReportMessagePresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test

class CustomReactionPresenterTests {
class CustomReactionPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test

class ReactionSummaryPresenterTests {
class ReactionSummaryPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test

class ReadReceiptBottomSheetPresenterTests {
class ReadReceiptBottomSheetPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test

class RetrySendMenuPresenterTests {
class RetrySendMenuPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.test.runTest
import org.junit.Test

class BlockedUsersPresenterTests {
class BlockedUsersPresenterTest {
@Test
fun `present - initial state with no blocked users`() = runTest {
val presenter = aBlockedUsersPresenter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import io.element.android.tests.testutils.consumeItemsUntilPredicate
import kotlinx.coroutines.test.runTest
import org.junit.Test

class EditDefaultNotificationSettingsPresenterTests {
class EditDefaultNotificationSettingsPresenterTest {
@Test
fun `present - ensures initial state is correct`() = runTest {
val notificationSettingsService = FakeNotificationSettingsService()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import kotlinx.coroutines.test.runTest
import org.junit.Test
import kotlin.time.Duration.Companion.milliseconds

class NotificationSettingsPresenterTests {
class NotificationSettingsPresenterTest {
@Test
fun `present - ensures initial state is correct`() = runTest {
val presenter = createNotificationSettingsPresenter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

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.userprofile.shared.UserProfileState
import io.element.android.libraries.matrix.api.core.RoomAlias
Expand Down Expand Up @@ -45,11 +46,13 @@ data class RoomDetailsState(
val eventSink: (RoomDetailsEvent) -> Unit
)

@Immutable
sealed interface RoomDetailsType {
data object Room : RoomDetailsType
data class Dm(val roomMember: RoomMember) : RoomDetailsType
}

@Immutable
sealed interface RoomTopicState {
data object Hidden : RoomTopicState
data object CanAddTopic : RoomTopicState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import org.junit.Test
import kotlin.time.Duration.Companion.milliseconds

@ExperimentalCoroutinesApi
class RoomDetailsPresenterTests {
class RoomDetailsPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import org.junit.Rule
import org.junit.Test

@ExperimentalCoroutinesApi
class RoomMemberListPresenterTests {
class RoomMemberListPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import org.junit.Rule
import org.junit.Test

@ExperimentalCoroutinesApi
class RoomMemberDetailsPresenterTests {
class RoomMemberDetailsPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.junit.Test

class DefaultRoomMembersModerationPresenterTests {
class DefaultRoomMembersModerationPresenterTest {
@Test
fun `canDisplayModerationActions - when room is DM is false`() = runTest {
val room = FakeMatrixRoom(isDirect = true, isPublic = true, isOneToOne = true).apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import io.element.android.tests.testutils.consumeItemsUntilPredicate
import kotlinx.coroutines.test.runTest
import org.junit.Test

class RoomNotificationSettingsPresenterTests {
class RoomNotificationSettingsPresenterTest {
@Test
fun `present - initial state is created from room info`() = runTest {
val presenter = createRoomNotificationSettingsPresenter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Test

class RolesAndPermissionPresenterTests {
class RolesAndPermissionPresenterTest {
@Test
fun `present - initial state`() = runTest {
val presenter = createRolesAndPermissionsPresenter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import org.junit.runner.RunWith
import org.robolectric.annotation.Config

@RunWith(AndroidJUnit4::class)
class RolesAndPermissionsViewTests {
class RolesAndPermissionsViewTest {
@get:Rule val rule = createAndroidComposeRule<ComponentActivity>()

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.junit.Test

class ChangeRolesPresenterTests {
class ChangeRolesPresenterTest {
@Test
fun `present - initial state`() = runTest {
val presenter = createChangeRolesPresenter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import io.element.android.services.analytics.test.FakeAnalyticsService
import kotlinx.coroutines.test.runTest
import org.junit.Test

class ChangeRoomPermissionsPresenterTests {
class ChangeRoomPermissionsPresenterTest {
@Test
fun `present - initial state`() = runTest {
val section = ChangeRoomPermissionsSection.RoomDetails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import org.junit.rules.TestRule
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class ChangeRoomPermissionsViewTests {
class ChangeRoomPermissionsViewTest {
@get:Rule val rule = createAndroidComposeRule<ComponentActivity>()

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test

class RoomListPresenterTests {
class RoomListPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import kotlinx.coroutines.test.runTest
import org.junit.Test
import io.element.android.libraries.matrix.api.roomlist.RoomListFilter as MatrixRoomListFilter

class RoomListFiltersPresenterTests {
class RoomListFiltersPresenterTest {
@Test
fun `present - initial state`() = runTest {
val presenter = createRoomListFiltersPresenter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class RoomListFiltersViewTests {
class RoomListFiltersViewTest {
@get:Rule val rule = createAndroidComposeRule<ComponentActivity>()

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.junit.Test

class RoomListSearchPresenterTests {
class RoomListSearchPresenterTest {
@Test
fun `present - initial state`() = runTest {
val presenter = createRoomListSearchPresenter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import org.junit.Rule
import org.junit.Test

@ExperimentalCoroutinesApi
class UserProfilePresenterTests {
class UserProfilePresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import org.junit.Rule
import org.junit.Test

@ExperimentalCoroutinesApi
class VerifySelfSessionPresenterTests {
class VerifySelfSessionPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ test_arch_core = "androidx.arch.core:core-testing:2.2.0"
test_junit = "junit:junit:4.13.2"
test_runner = "androidx.test:runner:1.5.2"
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_truth = "com.google.truth:truth:1.4.2"
test_parameter_injector = "com.google.testparameterinjector:test-parameter-injector:1.16"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import kotlinx.coroutines.test.runTest
import org.junit.Test

@OptIn(ExperimentalCoroutinesApi::class)
class AsyncIndicatorTests {
class AsyncIndicatorTest {
@Test
fun `initial state`() = runTest {
val state = AsyncIndicatorState()
Expand Down
Loading
Loading