summaryrefslogtreecommitdiffhomepage
path: root/android/test/arch/src
diff options
context:
space:
mode:
authorDavid Göransson <david.goransson@mullvad.net>2024-07-15 12:27:25 +0200
committerDavid Göransson <david.goransson@mullvad.net>2024-07-19 11:29:05 +0200
commit0bb1d8ecc81398db073aeb550ee4295284b515f7 (patch)
tree0db5d90935da957a44967c7feeda3f5ebdf0d10b /android/test/arch/src
parentafce27d5922636f08e5b7a86c4e2c2f2be9ff8b2 (diff)
downloadmullvadvpn-0bb1d8ecc81398db073aeb550ee4295284b515f7.tar.xz
mullvadvpn-0bb1d8ecc81398db073aeb550ee4295284b515f7.zip
Add ComposeDestinationsTests
Diffstat (limited to 'android/test/arch/src')
-rw-r--r--android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/compose/ComposeDestinationsTest.kt28
1 files changed, 28 insertions, 0 deletions
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")
+ }
+}