summaryrefslogtreecommitdiffhomepage
path: root/android/test
diff options
context:
space:
mode:
authorDavid Göransson <david.goransson@mullvad.net>2024-07-19 11:29:26 +0200
committerDavid Göransson <david.goransson@mullvad.net>2024-07-19 11:29:26 +0200
commit3a96d56cee566dd720a0f2ae5104ea57995868fc (patch)
tree2ab232b4896f983e623eb082f9708c4047b130eb /android/test
parentfeade99190b8282ef63512cc079a928c34baee13 (diff)
parent7f616dd1b42792138c36d63a6c0e0ff816ef9b6d (diff)
downloadmullvadvpn-3a96d56cee566dd720a0f2ae5104ea57995868fc.tar.xz
mullvadvpn-3a96d56cee566dd720a0f2ae5104ea57995868fc.zip
Merge branch 'align-screen-and-dialog-composable-names-droid-726'
Diffstat (limited to 'android/test')
-rw-r--r--android/test/arch/build.gradle.kts1
-rw-r--r--android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/compose/ComposeDestinationsTest.kt28
2 files changed, 29 insertions, 0 deletions
diff --git a/android/test/arch/build.gradle.kts b/android/test/arch/build.gradle.kts
index 2665083cb0..d2debc07dd 100644
--- a/android/test/arch/build.gradle.kts
+++ b/android/test/arch/build.gradle.kts
@@ -32,6 +32,7 @@ dependencies {
testRuntimeOnly(Dependencies.junitEngine)
testImplementation(Dependencies.Compose.uiToolingAndroidPreview)
+ testImplementation(Dependencies.Compose.destinations)
testImplementation(Dependencies.AndroidX.appcompat)
testImplementation(Dependencies.junitApi)
testImplementation(Dependencies.konsist)
diff --git a/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/compose/ComposeDestinationsTest.kt b/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/compose/ComposeDestinationsTest.kt
new file mode 100644
index 0000000000..7a638fb242
--- /dev/null
+++ b/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/compose/ComposeDestinationsTest.kt
@@ -0,0 +1,28 @@
+package net.mullvad.mullvadvpn.test.arch.compose
+
+import com.lemonappdev.konsist.api.Konsist
+import com.lemonappdev.konsist.api.ext.list.withAllAnnotationsOf
+import com.lemonappdev.konsist.api.verify.assertTrue
+import com.ramcosta.composedestinations.annotation.Destination
+import org.junit.jupiter.api.Test
+
+class ComposeDestinationsTest {
+ @Test
+ fun `ensure all destinations functions does not have invalid suffix`() =
+ allDestinationsFunctions().assertTrue { destinationFunction ->
+ DESTINATION_SUFFIXES.none { suffix -> destinationFunction.name.endsWith(suffix) }
+ }
+
+ @Test
+ fun `ensure all files that contains destinations ends with a valid suffix`() =
+ allDestinationsFunctions().assertTrue { destinationFunction ->
+ DESTINATION_SUFFIXES.any { destinationFunction.containingFile.name.endsWith(it) }
+ }
+
+ private fun allDestinationsFunctions() =
+ Konsist.scopeFromProduction("app").functions().withAllAnnotationsOf(Destination::class)
+
+ companion object {
+ private val DESTINATION_SUFFIXES = listOf("Screen", "Dialog")
+ }
+}