Migrate some tests to Robolectric (#1389)
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
7a532302e3
commit
213778122c
4 changed files with 12 additions and 0 deletions
|
@ -100,5 +100,6 @@ dependencies {
|
|||
|
||||
androidTestImplementation(libs.bundles.testDependencies)
|
||||
androidTestImplementation(libs.bundles.androidTestDependencies)
|
||||
testImplementation(libs.testing.robolectric)
|
||||
testImplementation(libs.bundles.testDependencies)
|
||||
}
|
||||
|
|
|
@ -7,7 +7,12 @@ package dev.msfjarvis.aps.util.totp
|
|||
|
||||
import kotlin.test.assertEquals
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [23])
|
||||
class UriTotpFinderTest {
|
||||
|
||||
private val totpFinder = UriTotpFinder()
|
|
@ -8,10 +8,15 @@ import kotlin.test.assertFalse
|
|||
import kotlin.test.assertNull
|
||||
import kotlin.test.assertTrue
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
private infix fun String.matchedForDomain(domain: String) =
|
||||
SearchableRepositoryViewModel.generateStrictDomainRegex(domain)?.containsMatchIn(this) == true
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [23])
|
||||
class StrictDomainRegexTest {
|
||||
|
||||
@Test
|
|
@ -74,6 +74,7 @@ thirdparty-nonfree-googlePlayAuthApiPhone = "com.google.android.gms:play-service
|
|||
# Testing dependencies
|
||||
testing-junit = "junit:junit:4.13.2"
|
||||
testing-kotlintest-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
|
||||
testing-robolectric = "org.robolectric:robolectric:4.5.1"
|
||||
androidx-testing-rules = { module = "androidx.test:rules", version.ref="androidx_test" }
|
||||
androidx-testing-runner = { module = "androidx.test:runner", version.ref="androidx_test" }
|
||||
kotlin-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }
|
||||
|
|
Loading…
Reference in a new issue