Konsist: add rule obout test class name, and fix existing issue

This commit is contained in:
Benoit Marty
2023-10-12 10:04:42 +02:00
committed by Benoit Marty
parent eebc39fab7
commit 7afae87b3e
11 changed files with 20 additions and 10 deletions

View File

@@ -18,11 +18,21 @@ package io.element.android.app
import com.lemonappdev.konsist.api.Konsist
import com.lemonappdev.konsist.api.ext.list.modifierprovider.withoutOverrideModifier
import com.lemonappdev.konsist.api.ext.list.withFunction
import com.lemonappdev.konsist.api.ext.list.withReturnType
import com.lemonappdev.konsist.api.verify.assertTrue
import org.junit.Test
class KonsistTestTest {
@Test
fun `Classes name containing @Test must end with 'Test''`() {
Konsist
.scopeFromTest()
.classes()
.withFunction { it.hasAnnotationOf(Test::class) }
.assertTrue { it.name.endsWith("Test") }
}
@Test
fun `Function which creates Presenter in test MUST be named 'createPresenterName'`() {
Konsist

View File

@@ -23,7 +23,7 @@ import org.robolectric.RobolectricTestRunner
import java.net.URLEncoder
@RunWith(RobolectricTestRunner::class)
class CallIntentDataParserTests {
class CallIntentDataParserTest {
private val callIntentDataParser = CallIntentDataParser()

View File

@@ -22,7 +22,7 @@ import io.element.android.libraries.matrix.api.auth.AuthenticationException
import io.element.android.libraries.ui.strings.CommonStrings
import org.junit.Test
class ErrorFormatterTests {
class ErrorFormatterTest {
// region loginError
@Test

View File

@@ -19,7 +19,7 @@ package io.element.android.libraries.core.extensions
import com.google.common.truth.Truth.assertThat
import org.junit.Test
class ResultTests {
class ResultTest {
@Test
fun testFlatMap() {

View File

@@ -61,7 +61,7 @@ import org.robolectric.annotation.Config
@Suppress("LargeClass")
@RunWith(RobolectricTestRunner::class)
class DefaultRoomLastMessageFormatterTests {
class DefaultRoomLastMessageFormatterTest {
private lateinit var context: Context
private lateinit var fakeMatrixClient: FakeMatrixClient

View File

@@ -19,7 +19,7 @@ package io.element.android.libraries.matrix.api.auth
import com.google.common.truth.Truth.assertThat
import org.junit.Test
class AuthErrorCodeTests {
class AuthErrorCodeTest {
@Test
fun `errorCode finds UNKNOWN code`() {

View File

@@ -23,7 +23,7 @@ import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
@RunWith(RobolectricTestRunner::class)
class MatrixToConverterTests {
class MatrixToConverterTest {
@Test
fun `converting a matrix-to url does nothing`() {

View File

@@ -23,7 +23,7 @@ import io.element.android.tests.testutils.assertThrowsInDebug
import io.element.android.tests.testutils.isInDebug
import org.junit.Test
class PermalinkBuilderTests {
class PermalinkBuilderTest {
fun `building a permalink for an invalid user id throws when verifying the id`() {
assertThrowsInDebug {

View File

@@ -22,7 +22,7 @@ import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
@RunWith(RobolectricTestRunner::class)
class PermalinkParserTests {
class PermalinkParserTest {
@Test
fun `parsing an invalid url returns a fallback link`() {

View File

@@ -22,7 +22,7 @@ import io.element.android.libraries.matrix.api.auth.AuthenticationException
import org.junit.Test
import org.matrix.rustcomponents.sdk.AuthenticationException as RustAuthenticationException
class AuthenticationExceptionMappingTests {
class AuthenticationExceptionMappingTest {
@Test
fun `mapping an exception with no message returns 'Unknown error' message`() {

View File

@@ -26,7 +26,7 @@ import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
@RunWith(RobolectricTestRunner::class)
class PickerTypeTests {
class PickerTypeTest {
@Test
fun `ImageAndVideo - assert types`() {