diff --git a/.idea/dictionaries/shared.xml b/.idea/dictionaries/shared.xml
index 2fc10f455b..c3aa70ef23 100644
--- a/.idea/dictionaries/shared.xml
+++ b/.idea/dictionaries/shared.xml
@@ -4,6 +4,7 @@
backstack
ftue
homeserver
+ konsist
kover
measurables
onboarding
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 839a5095dd..5286bde045 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -230,6 +230,7 @@ dependencies {
testImplementation(libs.test.truth)
testImplementation(libs.test.turbine)
testImplementation(projects.libraries.matrix.test)
+ testImplementation(libs.test.konsist)
ksp(libs.showkase.processor)
}
diff --git a/app/src/test/kotlin/io/element/android/app/KonsistTest.kt b/app/src/test/kotlin/io/element/android/app/KonsistTest.kt
new file mode 100644
index 0000000000..451fd8fe00
--- /dev/null
+++ b/app/src/test/kotlin/io/element/android/app/KonsistTest.kt
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2023 New Vector Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.element.android.app
+
+import com.lemonappdev.konsist.api.Konsist
+import com.lemonappdev.konsist.api.ext.list.withAllAnnotationsOf
+import com.lemonappdev.konsist.api.ext.list.withAllParentsOf
+import com.lemonappdev.konsist.api.verify.assertTrue
+import io.element.android.libraries.architecture.Presenter
+import io.element.android.libraries.designsystem.preview.PreviewsDayNight
+import org.junit.Test
+
+class KonsistTest {
+
+ @Test
+ fun `classes extending 'Presenter' should have 'Presenter' suffix`() {
+ Konsist.scopeFromProject()
+ .classes()
+ .withAllParentsOf(Presenter::class)
+ .assertTrue { it.name.endsWith("Presenter") }
+ }
+
+ @Test
+ fun `function with '@PreviewsDayNight' annotation should have 'Preview' suffix`() {
+ Konsist
+ .scopeFromProject()
+ .functions()
+ .withAllAnnotationsOf(PreviewsDayNight::class)
+ .assertTrue {
+ it.hasNameEndingWith("Preview") &&
+ it.hasNameEndingWith("LightPreview").not() &&
+ it.hasNameEndingWith("DarkPreview").not()
+ }
+ }
+}
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index a5ce502f9c..22eac10dd7 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -130,6 +130,7 @@ test_uiautomator = "androidx.test.uiautomator:uiautomator:2.2.0"
test_junitext = "androidx.test.ext:junit:1.1.5"
test_mockk = "io.mockk:mockk:1.13.8"
test_barista = "com.adevinta.android:barista:4.3.0"
+test_konsist = "com.lemonappdev:konsist:0.13.0"
test_hamcrest = "org.hamcrest:hamcrest:2.2"
test_orchestrator = "androidx.test:orchestrator:1.4.2"
test_turbine = "app.cash.turbine:turbine:1.0.0"