diff options
| author | David Göransson <david.goransson@mullvad.net> | 2024-07-15 12:27:25 +0200 |
|---|---|---|
| committer | David Göransson <david.goransson@mullvad.net> | 2024-07-19 11:29:05 +0200 |
| commit | 0bb1d8ecc81398db073aeb550ee4295284b515f7 (patch) | |
| tree | 0db5d90935da957a44967c7feeda3f5ebdf0d10b /android/test | |
| parent | afce27d5922636f08e5b7a86c4e2c2f2be9ff8b2 (diff) | |
| download | mullvadvpn-0bb1d8ecc81398db073aeb550ee4295284b515f7.tar.xz mullvadvpn-0bb1d8ecc81398db073aeb550ee4295284b515f7.zip | |
Add ComposeDestinationsTests
Diffstat (limited to 'android/test')
| -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") + } +} |
