-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test ensure all composables are in compose package
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/classes/DataClassTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 } | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/compose/ComposeTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |