summaryrefslogtreecommitdiffhomepage
path: root/android/test/arch/src
diff options
context:
space:
mode:
authorDavid Göransson <david.goransson90@gmail.com>2023-09-29 20:02:08 +0200
committerDavid Göransson <david.goransson90@gmail.com>2023-10-02 16:06:03 +0200
commit3d38b605ca87c63e293afecb3e37f062c4f31265 (patch)
treecbce556569110b160120a9ede5eea2697b0d710b /android/test/arch/src
parent0995760e5ea6dde06b56065ea45346c1f9672839 (diff)
downloadmullvadvpn-3d38b605ca87c63e293afecb3e37f062c4f31265.tar.xz
mullvadvpn-3d38b605ca87c63e293afecb3e37f062c4f31265.zip
Add Compose Preview test and fix issues
Diffstat (limited to 'android/test/arch/src')
-rw-r--r--android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/compose/ComposePreviewTests.kt22
1 files changed, 22 insertions, 0 deletions
diff --git a/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/compose/ComposePreviewTests.kt b/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/compose/ComposePreviewTests.kt
new file mode 100644
index 0000000000..64b221d0c0
--- /dev/null
+++ b/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/compose/ComposePreviewTests.kt
@@ -0,0 +1,22 @@
+package net.mullvad.mullvadvpn.test.arch.compose
+
+import androidx.compose.ui.tooling.preview.Preview
+import com.lemonappdev.konsist.api.Konsist
+import com.lemonappdev.konsist.api.ext.list.withAllAnnotationsOf
+import com.lemonappdev.konsist.api.verify.assert
+import org.junit.Test
+
+class ComposePreviewTests {
+ @Test
+ fun `all preview functions are private`() {
+ allPreviewFunctions().assert { it.hasPrivateModifier }
+ }
+
+ @Test
+ fun `all preview functions are prefixed with Preview`() {
+ allPreviewFunctions().assert { it.name.startsWith("Preview") }
+ }
+
+ private fun allPreviewFunctions() =
+ Konsist.scopeFromProduction().functions().withAllAnnotationsOf(Preview::class)
+}