Add Konsist test Fake classes must be named using Fake and the interface it fakes
This commit is contained in:
parent
85c8a26f8a
commit
4113bae938
1 changed files with 13 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
|||
import com.bumble.appyx.core.node.Node
|
||||
import com.lemonappdev.konsist.api.Konsist
|
||||
import com.lemonappdev.konsist.api.ext.list.withAllParentsOf
|
||||
import com.lemonappdev.konsist.api.ext.list.withNameContaining
|
||||
import com.lemonappdev.konsist.api.verify.assertTrue
|
||||
import io.element.android.libraries.architecture.Presenter
|
||||
import org.junit.Test
|
||||
|
|
@ -62,4 +63,16 @@ class KonsistClassNameTest {
|
|||
it.name.endsWith("Provider") && (it.name.contains("IconList") || it.name.contains(providedType))
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Fake classes must be named using Fake and the interface it fakes`() {
|
||||
Konsist.scopeFromProject()
|
||||
.classes()
|
||||
.withNameContaining("Fake")
|
||||
.assertTrue {
|
||||
val interfaceName = it.name.replace("Fake", "")
|
||||
it.name.startsWith("Fake") &&
|
||||
it.parents.any { parent -> parent.name.replace(".", "") == interfaceName }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue