PR#57 Remove unnecessary TestCoroutineScheduler creation
This commit is contained in:
parent
88b122e0b7
commit
02ac524dd3
5 changed files with 6 additions and 10 deletions
|
|
@ -6,7 +6,6 @@ import kotlinx.coroutines.flow.first
|
||||||
import kotlinx.coroutines.flow.take
|
import kotlinx.coroutines.flow.take
|
||||||
import kotlinx.coroutines.flow.toList
|
import kotlinx.coroutines.flow.toList
|
||||||
import kotlinx.coroutines.test.StandardTestDispatcher
|
import kotlinx.coroutines.test.StandardTestDispatcher
|
||||||
import kotlinx.coroutines.test.TestCoroutineScheduler
|
|
||||||
import kotlinx.coroutines.test.TestDispatcher
|
import kotlinx.coroutines.test.TestDispatcher
|
||||||
import kotlinx.coroutines.test.advanceUntilIdle
|
import kotlinx.coroutines.test.advanceUntilIdle
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
|
|
@ -36,7 +35,7 @@ internal class FavouriteContentLocalStorageImplInstrumentedTest(
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
testDispatcher = StandardTestDispatcher(TestCoroutineScheduler())
|
testDispatcher = StandardTestDispatcher()
|
||||||
DatabaseInitialization.dispatcher = testDispatcher
|
DatabaseInitialization.dispatcher = testDispatcher
|
||||||
sut = favouriteContentLocalStorageFactory()
|
sut = favouriteContentLocalStorageFactory()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.test.StandardTestDispatcher
|
import kotlinx.coroutines.test.StandardTestDispatcher
|
||||||
import kotlinx.coroutines.test.TestCoroutineScheduler
|
|
||||||
import kotlinx.coroutines.test.TestDispatcher
|
import kotlinx.coroutines.test.TestDispatcher
|
||||||
import kotlinx.coroutines.test.resetMain
|
import kotlinx.coroutines.test.resetMain
|
||||||
import kotlinx.coroutines.test.setMain
|
import kotlinx.coroutines.test.setMain
|
||||||
|
|
@ -43,7 +42,7 @@ class RobolectricAuthActivityInstrumentedTest : KoinTest {
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
Intents.init()
|
Intents.init()
|
||||||
val dispatcher = StandardTestDispatcher(TestCoroutineScheduler())
|
val dispatcher = StandardTestDispatcher()
|
||||||
Dispatchers.setMain(dispatcher)
|
Dispatchers.setMain(dispatcher)
|
||||||
testDispatcher = dispatcher
|
testDispatcher = dispatcher
|
||||||
DatabaseInitialization.dispatcher = dispatcher
|
DatabaseInitialization.dispatcher = dispatcher
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package org.fnives.test.showcase.testutils.idling
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.test.StandardTestDispatcher
|
import kotlinx.coroutines.test.StandardTestDispatcher
|
||||||
import kotlinx.coroutines.test.TestCoroutineScheduler
|
|
||||||
import kotlinx.coroutines.test.TestDispatcher
|
import kotlinx.coroutines.test.TestDispatcher
|
||||||
import kotlinx.coroutines.test.resetMain
|
import kotlinx.coroutines.test.resetMain
|
||||||
import kotlinx.coroutines.test.setMain
|
import kotlinx.coroutines.test.setMain
|
||||||
|
|
@ -22,7 +21,7 @@ class MainDispatcherTestRule : TestRule {
|
||||||
object : Statement() {
|
object : Statement() {
|
||||||
@Throws(Throwable::class)
|
@Throws(Throwable::class)
|
||||||
override fun evaluate() {
|
override fun evaluate() {
|
||||||
val dispatcher = StandardTestDispatcher(TestCoroutineScheduler())
|
val dispatcher = StandardTestDispatcher()
|
||||||
Dispatchers.setMain(dispatcher)
|
Dispatchers.setMain(dispatcher)
|
||||||
testDispatcher = dispatcher
|
testDispatcher = dispatcher
|
||||||
DatabaseInitialization.dispatcher = dispatcher
|
DatabaseInitialization.dispatcher = dispatcher
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package org.fnives.test.showcase.testutils
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.test.StandardTestDispatcher
|
import kotlinx.coroutines.test.StandardTestDispatcher
|
||||||
import kotlinx.coroutines.test.TestCoroutineScheduler
|
|
||||||
import kotlinx.coroutines.test.TestDispatcher
|
import kotlinx.coroutines.test.TestDispatcher
|
||||||
import kotlinx.coroutines.test.resetMain
|
import kotlinx.coroutines.test.resetMain
|
||||||
import kotlinx.coroutines.test.setMain
|
import kotlinx.coroutines.test.setMain
|
||||||
|
|
@ -22,7 +21,7 @@ import org.junit.jupiter.api.extension.ExtensionContext
|
||||||
class TestMainDispatcher : BeforeEachCallback, AfterEachCallback {
|
class TestMainDispatcher : BeforeEachCallback, AfterEachCallback {
|
||||||
|
|
||||||
override fun beforeEach(context: ExtensionContext?) {
|
override fun beforeEach(context: ExtensionContext?) {
|
||||||
val testDispatcher = StandardTestDispatcher(TestCoroutineScheduler())
|
val testDispatcher = StandardTestDispatcher()
|
||||||
privateTestDispatcher = testDispatcher
|
privateTestDispatcher = testDispatcher
|
||||||
DatabaseInitialization.dispatcher = testDispatcher
|
DatabaseInitialization.dispatcher = testDispatcher
|
||||||
Dispatchers.setMain(testDispatcher)
|
Dispatchers.setMain(testDispatcher)
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ private lateinit var testDispatcher: TestDispatcher
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
testDispatcher = StandardTestDispatcher(TestCoroutineScheduler())
|
testDispatcher = StandardTestDispatcher()
|
||||||
DatabaseInitialization.dispatcher = testDispatcher
|
DatabaseInitialization.dispatcher = testDispatcher
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -523,7 +523,7 @@ We use a TestDispatcher and initialize our database with it as well.
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
//...
|
//...
|
||||||
val dispatcher = StandardTestDispatcher(TestCoroutineScheduler())
|
val dispatcher = StandardTestDispatcher()
|
||||||
Dispatchers.setMain(dispatcher)
|
Dispatchers.setMain(dispatcher)
|
||||||
testDispatcher = dispatcher
|
testDispatcher = dispatcher
|
||||||
DatabaseInitialization.dispatcher = dispatcher
|
DatabaseInitialization.dispatcher = dispatcher
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue