diff options
Diffstat (limited to 'android')
| -rw-r--r-- | android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/compose/ComposeDestinationsTest.kt | 28 |
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") + } +} |
