Skip to content

Commit

Permalink
Add test ensure all composables are in compose package
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Sep 29, 2023
1 parent 5165f23 commit 0bace75
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package net.mullvad.mullvadvpn.test.arch.classes

import com.lemonappdev.konsist.api.ext.list.modifierprovider.withDataModifier
import com.lemonappdev.konsist.api.verify.assert
import net.mullvad.mullvadvpn.test.arch.extensions.projectScope
import org.junit.Ignore
import org.junit.Test

class DataClasses {
@Ignore("Code needs clean up")
@Test
fun `data classes use only immutable parameters`() {
projectScope().classes(includeNested = true).withDataModifier().assert {
it.properties(includeNested = true).all { property -> property.hasValModifier }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package net.mullvad.mullvadvpn.test.arch.compose

import androidx.compose.runtime.Composable
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 ComposeTests {
@Test
fun `all app composables are in the compose packages`() {
allAppComposeFunctions().assert {
it.fullyQualifiedName.startsWith("net.mullvad.mullvadvpn.compose")
}
}

private fun allAppComposeFunctions() =
Konsist.scopeFromProduction("app").functions().withAllAnnotationsOf(Composable::class)
}

0 comments on commit 0bace75

Please sign in to comment.