Skip to content

Commit

Permalink
Add konsist test name check
Browse files Browse the repository at this point in the history
Checks that the tests are prefixed with "ensure "
  • Loading branch information
albin-mullvad committed Oct 2, 2023
1 parent 3f6a24d commit 54a8e71
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package net.mullvad.mullvadvpn.test.arch

import com.lemonappdev.konsist.api.Konsist
import com.lemonappdev.konsist.api.ext.list.withAnnotationOf
import com.lemonappdev.konsist.api.verify.assert
import org.junit.Test

class KonsistTests {
@Test
fun `ensure konsist tests have 'ensure ' prefix`() =
Konsist.scopeFromModule("test/arch").functions().withAnnotationOf(Test::class).assert {
it.hasNameStartingWith("ensure ")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import org.junit.Test

class ViewModelTests {
@Test
fun ensureViewModelsHaveViewModelSuffix() =
fun `ensure view models have view model suffix`() =
allViewModels().assert { it.name.endsWith("ViewModel") }

// The purpose of this check is to both keep the naming consistent and also to avoid exposing
Expand Down

0 comments on commit 54a8e71

Please sign in to comment.