Add some Konsist test.
This commit is contained in:
parent
7e91e7824e
commit
675f77bfa4
4 changed files with 52 additions and 0 deletions
1
.idea/dictionaries/shared.xml
generated
1
.idea/dictionaries/shared.xml
generated
|
|
@ -4,6 +4,7 @@
|
||||||
<w>backstack</w>
|
<w>backstack</w>
|
||||||
<w>ftue</w>
|
<w>ftue</w>
|
||||||
<w>homeserver</w>
|
<w>homeserver</w>
|
||||||
|
<w>konsist</w>
|
||||||
<w>kover</w>
|
<w>kover</w>
|
||||||
<w>measurables</w>
|
<w>measurables</w>
|
||||||
<w>onboarding</w>
|
<w>onboarding</w>
|
||||||
|
|
|
||||||
|
|
@ -230,6 +230,7 @@ dependencies {
|
||||||
testImplementation(libs.test.truth)
|
testImplementation(libs.test.truth)
|
||||||
testImplementation(libs.test.turbine)
|
testImplementation(libs.test.turbine)
|
||||||
testImplementation(projects.libraries.matrix.test)
|
testImplementation(projects.libraries.matrix.test)
|
||||||
|
testImplementation(libs.test.konsist)
|
||||||
|
|
||||||
ksp(libs.showkase.processor)
|
ksp(libs.showkase.processor)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
49
app/src/test/kotlin/io/element/android/app/KonsistTest.kt
Normal file
49
app/src/test/kotlin/io/element/android/app/KonsistTest.kt
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.element.android.app
|
||||||
|
|
||||||
|
import com.lemonappdev.konsist.api.Konsist
|
||||||
|
import com.lemonappdev.konsist.api.ext.list.withAllAnnotationsOf
|
||||||
|
import com.lemonappdev.konsist.api.ext.list.withAllParentsOf
|
||||||
|
import com.lemonappdev.konsist.api.verify.assertTrue
|
||||||
|
import io.element.android.libraries.architecture.Presenter
|
||||||
|
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
class KonsistTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `classes extending 'Presenter' should have 'Presenter' suffix`() {
|
||||||
|
Konsist.scopeFromProject()
|
||||||
|
.classes()
|
||||||
|
.withAllParentsOf(Presenter::class)
|
||||||
|
.assertTrue { it.name.endsWith("Presenter") }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `function with '@PreviewsDayNight' annotation should have 'Preview' suffix`() {
|
||||||
|
Konsist
|
||||||
|
.scopeFromProject()
|
||||||
|
.functions()
|
||||||
|
.withAllAnnotationsOf(PreviewsDayNight::class)
|
||||||
|
.assertTrue {
|
||||||
|
it.hasNameEndingWith("Preview") &&
|
||||||
|
it.hasNameEndingWith("LightPreview").not() &&
|
||||||
|
it.hasNameEndingWith("DarkPreview").not()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -130,6 +130,7 @@ test_uiautomator = "androidx.test.uiautomator:uiautomator:2.2.0"
|
||||||
test_junitext = "androidx.test.ext:junit:1.1.5"
|
test_junitext = "androidx.test.ext:junit:1.1.5"
|
||||||
test_mockk = "io.mockk:mockk:1.13.8"
|
test_mockk = "io.mockk:mockk:1.13.8"
|
||||||
test_barista = "com.adevinta.android:barista:4.3.0"
|
test_barista = "com.adevinta.android:barista:4.3.0"
|
||||||
|
test_konsist = "com.lemonappdev:konsist:0.13.0"
|
||||||
test_hamcrest = "org.hamcrest:hamcrest:2.2"
|
test_hamcrest = "org.hamcrest:hamcrest:2.2"
|
||||||
test_orchestrator = "androidx.test:orchestrator:1.4.2"
|
test_orchestrator = "androidx.test:orchestrator:1.4.2"
|
||||||
test_turbine = "app.cash.turbine:turbine:1.0.0"
|
test_turbine = "app.cash.turbine:turbine:1.0.0"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue