mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-05 12:54:35 +00:00
Add Konsist test Fake classes must be named using Fake and the interface it fakes
This commit is contained in:
committed by
Benoit Marty
parent
85c8a26f8a
commit
4113bae938
+13
@@ -20,6 +20,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
|||||||
import com.bumble.appyx.core.node.Node
|
import com.bumble.appyx.core.node.Node
|
||||||
import com.lemonappdev.konsist.api.Konsist
|
import com.lemonappdev.konsist.api.Konsist
|
||||||
import com.lemonappdev.konsist.api.ext.list.withAllParentsOf
|
import com.lemonappdev.konsist.api.ext.list.withAllParentsOf
|
||||||
|
import com.lemonappdev.konsist.api.ext.list.withNameContaining
|
||||||
import com.lemonappdev.konsist.api.verify.assertTrue
|
import com.lemonappdev.konsist.api.verify.assertTrue
|
||||||
import io.element.android.libraries.architecture.Presenter
|
import io.element.android.libraries.architecture.Presenter
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -62,4 +63,16 @@ class KonsistClassNameTest {
|
|||||||
it.name.endsWith("Provider") && (it.name.contains("IconList") || it.name.contains(providedType))
|
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 }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user