feat: remove unnecessary CoroutineTestRule
This commit is contained in:
parent
b9abf3ef43
commit
a76da935cd
6 changed files with 0 additions and 72 deletions
|
@ -1,11 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-only
|
|
||||||
*/
|
|
||||||
plugins { id("com.github.android-password-store.kotlin-jvm-library") }
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation(projects.coroutineUtils)
|
|
||||||
implementation(libs.testing.junit)
|
|
||||||
implementation(libs.kotlin.coroutines.test)
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<issues format="6" by="lint 8.0.0" type="baseline" client="gradle" dependencies="false" name="AGP (8.0.0)" variant="all" version="8.0.0">
|
|
||||||
|
|
||||||
</issues>
|
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
package app.passwordstore.test
|
|
||||||
|
|
||||||
import app.passwordstore.util.coroutines.DispatcherProvider
|
|
||||||
import kotlinx.coroutines.CoroutineDispatcher
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
|
||||||
import kotlinx.coroutines.test.TestCoroutineScheduler
|
|
||||||
import kotlinx.coroutines.test.TestDispatcher
|
|
||||||
import kotlinx.coroutines.test.UnconfinedTestDispatcher
|
|
||||||
import kotlinx.coroutines.test.resetMain
|
|
||||||
import kotlinx.coroutines.test.setMain
|
|
||||||
import org.junit.rules.TestWatcher
|
|
||||||
import org.junit.runner.Description
|
|
||||||
|
|
||||||
/**
|
|
||||||
* JUnit [TestWatcher] to correctly handle setting and resetting a given [testDispatcher] for tests.
|
|
||||||
*/
|
|
||||||
@ExperimentalCoroutinesApi
|
|
||||||
public class CoroutineTestRule(
|
|
||||||
public val testDispatcher: TestDispatcher = UnconfinedTestDispatcher(TestCoroutineScheduler()),
|
|
||||||
) : TestWatcher() {
|
|
||||||
|
|
||||||
public val testDispatcherProvider: DispatcherProvider =
|
|
||||||
object : DispatcherProvider {
|
|
||||||
override fun default(): CoroutineDispatcher = testDispatcher
|
|
||||||
|
|
||||||
override fun io(): CoroutineDispatcher = testDispatcher
|
|
||||||
|
|
||||||
override fun main(): CoroutineDispatcher = testDispatcher
|
|
||||||
|
|
||||||
override fun unconfined(): CoroutineDispatcher = testDispatcher
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun starting(description: Description) {
|
|
||||||
super.starting(description)
|
|
||||||
Dispatchers.setMain(testDispatcher)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun finished(description: Description) {
|
|
||||||
super.finished(description)
|
|
||||||
Dispatchers.resetMain()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,7 +12,6 @@ dependencies {
|
||||||
implementation(libs.dagger.hilt.core)
|
implementation(libs.dagger.hilt.core)
|
||||||
implementation(libs.thirdparty.commons.codec)
|
implementation(libs.thirdparty.commons.codec)
|
||||||
implementation(libs.thirdparty.uri)
|
implementation(libs.thirdparty.uri)
|
||||||
testImplementation(projects.coroutineUtilsTesting)
|
|
||||||
testImplementation(libs.bundles.testDependencies)
|
testImplementation(libs.bundles.testDependencies)
|
||||||
testImplementation(libs.kotlin.coroutines.test)
|
testImplementation(libs.kotlin.coroutines.test)
|
||||||
testImplementation(libs.testing.turbine)
|
testImplementation(libs.testing.turbine)
|
||||||
|
|
|
@ -7,7 +7,6 @@ package app.passwordstore.data.passfile
|
||||||
|
|
||||||
import app.cash.turbine.Event
|
import app.cash.turbine.Event
|
||||||
import app.cash.turbine.test
|
import app.cash.turbine.test
|
||||||
import app.passwordstore.test.CoroutineTestRule
|
|
||||||
import app.passwordstore.util.time.TestUserClock
|
import app.passwordstore.util.time.TestUserClock
|
||||||
import app.passwordstore.util.time.UserClock
|
import app.passwordstore.util.time.UserClock
|
||||||
import app.passwordstore.util.totp.UriTotpFinder
|
import app.passwordstore.util.totp.UriTotpFinder
|
||||||
|
@ -18,16 +17,11 @@ import kotlin.test.assertNotNull
|
||||||
import kotlin.test.assertNull
|
import kotlin.test.assertNull
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
import kotlin.time.Duration.Companion.seconds
|
import kotlin.time.Duration.Companion.seconds
|
||||||
import kotlin.time.ExperimentalTime
|
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Rule
|
|
||||||
|
|
||||||
@OptIn(ExperimentalCoroutinesApi::class, ExperimentalTime::class)
|
|
||||||
class PasswordEntryTest {
|
class PasswordEntryTest {
|
||||||
|
|
||||||
@get:Rule val coroutineTestRule: CoroutineTestRule = CoroutineTestRule()
|
|
||||||
private val totpFinder = UriTotpFinder()
|
private val totpFinder = UriTotpFinder()
|
||||||
|
|
||||||
private fun makeEntry(content: String, clock: UserClock = fakeClock) =
|
private fun makeEntry(content: String, clock: UserClock = fakeClock) =
|
||||||
|
|
|
@ -171,8 +171,6 @@ include("autofill-parser")
|
||||||
|
|
||||||
include("coroutine-utils")
|
include("coroutine-utils")
|
||||||
|
|
||||||
include("coroutine-utils-testing")
|
|
||||||
|
|
||||||
include("crypto-common")
|
include("crypto-common")
|
||||||
|
|
||||||
include("crypto-pgpainless")
|
include("crypto-pgpainless")
|
||||||
|
|
Loading…
Reference in a new issue