summaryrefslogtreecommitdiffhomepage
path: root/android/test
diff options
context:
space:
mode:
authorAlbin <albin@mullvad.net>2023-09-29 16:57:37 +0200
committerAlbin <albin@mullvad.net>2023-09-29 16:57:37 +0200
commitf9706c3bf2f636b2a155d7d490d20ba57fa2eada (patch)
tree15e9d812c81ca0265a59357a46d7b415e9a9c544 /android/test
parent567de191daed12cd2645ca4e09c4edc6bf108a4b (diff)
parentbc4440546d6581a41db84064beb7920325a6d984 (diff)
downloadmullvadvpn-f9706c3bf2f636b2a155d7d490d20ba57fa2eada.tar.xz
mullvadvpn-f9706c3bf2f636b2a155d7d490d20ba57fa2eada.zip
Merge branch 'add-konsist-for-arch-testing-droid-334'
Diffstat (limited to 'android/test')
-rw-r--r--android/test/arch/build.gradle.kts42
-rw-r--r--android/test/arch/src/test/AndroidManifest.xml1
-rw-r--r--android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/ViewModelTests.kt16
3 files changed, 59 insertions, 0 deletions
diff --git a/android/test/arch/build.gradle.kts b/android/test/arch/build.gradle.kts
new file mode 100644
index 0000000000..0a28fd2fab
--- /dev/null
+++ b/android/test/arch/build.gradle.kts
@@ -0,0 +1,42 @@
+plugins {
+ id(Dependencies.Plugin.androidLibraryId)
+ id(Dependencies.Plugin.kotlinAndroidId)
+}
+
+android {
+ namespace = "net.mullvad.mullvadvpn.test.arch"
+ compileSdk = Versions.Android.compileSdkVersion
+
+ defaultConfig {
+ minSdk = Versions.Android.minSdkVersion
+ }
+
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_17
+ }
+
+ kotlinOptions {
+ jvmTarget = Versions.jvmTarget
+ }
+
+ lint {
+ lintConfig = file("${rootProject.projectDir}/config/lint.xml")
+ abortOnError = true
+ warningsAsErrors = true
+ }
+}
+
+androidComponents {
+ beforeVariants { variantBuilder ->
+ variantBuilder.apply {
+ enable = name != "release"
+ }
+ }
+}
+
+dependencies {
+ testImplementation(Dependencies.AndroidX.appcompat)
+ testImplementation(Dependencies.junit)
+ testImplementation(Dependencies.konsist)
+}
diff --git a/android/test/arch/src/test/AndroidManifest.xml b/android/test/arch/src/test/AndroidManifest.xml
new file mode 100644
index 0000000000..cc947c5679
--- /dev/null
+++ b/android/test/arch/src/test/AndroidManifest.xml
@@ -0,0 +1 @@
+<manifest />
diff --git a/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/ViewModelTests.kt b/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/ViewModelTests.kt
new file mode 100644
index 0000000000..35ffe52c31
--- /dev/null
+++ b/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/ViewModelTests.kt
@@ -0,0 +1,16 @@
+package net.mullvad.mullvadvpn.test.arch
+
+import androidx.lifecycle.ViewModel
+import com.lemonappdev.konsist.api.Konsist
+import com.lemonappdev.konsist.api.ext.list.withAllParentsOf
+import com.lemonappdev.konsist.api.verify.assert
+import org.junit.Test
+
+class ViewModelTests {
+ @Test
+ fun ensureViewModelsHaveViewModelSuffix() {
+ Konsist.scopeFromProject().classes().withAllParentsOf(ViewModel::class).assert {
+ it.name.endsWith("ViewModel")
+ }
+ }
+}