mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-08-19 12:49:54 +01:00
Fix hang in DraftRepositoryTest.
This commit is contained in:
committed by
Alex Hart
parent
7195c21a8c
commit
7e6c89931d
+12
@@ -8,6 +8,9 @@ package org.thoughtcrime.securesms.conversation.drafts
|
||||
import android.app.Application
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.reactivex.rxjava3.plugins.RxJavaPlugins
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Before
|
||||
@@ -48,10 +51,19 @@ class DraftRepositoryTest {
|
||||
fun setUp() {
|
||||
Log.initialize(SystemOutLogger())
|
||||
|
||||
// Another test sharing this Robolectric sandbox may have already initialized Schedulers.io() to a
|
||||
// TestScheduler that nothing advances, which would make load()'s blockingGet() wait forever. Run inline.
|
||||
RxJavaPlugins.setIoSchedulerHandler { Schedulers.trampoline() }
|
||||
|
||||
draftTable = mockk(relaxed = true)
|
||||
every { draftTable.getDrafts(any()) } returns DraftTable.Drafts()
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
RxJavaPlugins.setIoSchedulerHandler(null)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `unprocessed share is delivered and advances the marker`() {
|
||||
val result = repository(shareDataTimestamp = 1000L, draftText = "shared text").load()
|
||||
|
||||
Reference in New Issue
Block a user