Konsist: add rule obout test class name, and fix existing issue
This commit is contained in:
committed by
Benoit Marty
parent
eebc39fab7
commit
7afae87b3e
@@ -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
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.robolectric.RobolectricTestRunner
|
||||
import java.net.URLEncoder
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class CallIntentDataParserTests {
|
||||
class CallIntentDataParserTest {
|
||||
|
||||
private val callIntentDataParser = CallIntentDataParser()
|
||||
|
||||
@@ -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
|
||||
@@ -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() {
|
||||
@@ -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
|
||||
@@ -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`() {
|
||||
@@ -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`() {
|
||||
@@ -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 {
|
||||
@@ -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`() {
|
||||
@@ -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`() {
|
||||
@@ -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`() {
|
||||
Reference in New Issue
Block a user