mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Use a TestDispatcher in the FakeSession
This commit is contained in:
parent
5b3711b634
commit
8476fba5ff
3 changed files with 8 additions and 16 deletions
|
@ -16,21 +16,16 @@
|
||||||
|
|
||||||
package im.vector.app.features.location.domain.usecase
|
package im.vector.app.features.location.domain.usecase
|
||||||
|
|
||||||
import com.airbnb.mvrx.test.MvRxTestRule
|
|
||||||
import im.vector.app.features.location.LocationData
|
import im.vector.app.features.location.LocationData
|
||||||
import im.vector.app.test.fakes.FakeSession
|
import im.vector.app.test.fakes.FakeSession
|
||||||
import io.mockk.MockKAnnotations
|
import io.mockk.MockKAnnotations
|
||||||
import io.mockk.impl.annotations.OverrideMockKs
|
import io.mockk.impl.annotations.OverrideMockKs
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Rule
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class CompareLocationsUseCaseTest {
|
class CompareLocationsUseCaseTest {
|
||||||
|
|
||||||
@get:Rule
|
|
||||||
val mvRxTestRule = MvRxTestRule()
|
|
||||||
|
|
||||||
private val session = FakeSession()
|
private val session = FakeSession()
|
||||||
|
|
||||||
@OverrideMockKs
|
@OverrideMockKs
|
||||||
|
|
|
@ -19,7 +19,6 @@ package im.vector.app.features.media.domain.usecase
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
import com.airbnb.mvrx.test.MvRxTestRule
|
|
||||||
import im.vector.app.core.intent.getMimeTypeFromUri
|
import im.vector.app.core.intent.getMimeTypeFromUri
|
||||||
import im.vector.app.core.utils.saveMedia
|
import im.vector.app.core.utils.saveMedia
|
||||||
import im.vector.app.features.notifications.NotificationUtils
|
import im.vector.app.features.notifications.NotificationUtils
|
||||||
|
@ -42,14 +41,10 @@ import io.mockk.verifyAll
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Rule
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class DownloadMediaUseCaseTest {
|
class DownloadMediaUseCaseTest {
|
||||||
|
|
||||||
@get:Rule
|
|
||||||
val mvRxTestRule = MvRxTestRule()
|
|
||||||
|
|
||||||
@MockK
|
@MockK
|
||||||
lateinit var appContext: Context
|
lateinit var appContext: Context
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,15 @@
|
||||||
|
|
||||||
package im.vector.app.test
|
package im.vector.app.test
|
||||||
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.test.UnconfinedTestDispatcher
|
||||||
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
|
|
||||||
|
private val testDispatcher = UnconfinedTestDispatcher()
|
||||||
|
|
||||||
internal val testCoroutineDispatchers = MatrixCoroutineDispatchers(
|
internal val testCoroutineDispatchers = MatrixCoroutineDispatchers(
|
||||||
io = Dispatchers.Main,
|
io = testDispatcher,
|
||||||
computation = Dispatchers.Main,
|
computation = testDispatcher,
|
||||||
main = Dispatchers.Main,
|
main = testDispatcher,
|
||||||
crypto = Dispatchers.Main,
|
crypto = testDispatcher,
|
||||||
dmVerif = Dispatchers.Main
|
dmVerif = testDispatcher
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue