Add test for MessageComposerEvents.SendUri

This commit is contained in:
Benoit Marty
2024-02-19 13:28:18 +01:00
committed by Benoit Marty
parent e006f375ae
commit 9586c61273

View File

@@ -87,10 +87,13 @@ import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import uniffi.wysiwyg_composer.MentionsState
import java.io.File
@Suppress("LargeClass")
@RunWith(RobolectricTestRunner::class)
class MessageComposerPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()
@@ -875,6 +878,19 @@ class MessageComposerPresenterTest {
}
}
@Test
fun `present - send uri`() = runTest {
val presenter = createPresenter(this)
moleculeFlow(RecompositionMode.Immediate) {
val state = presenter.present()
remember(state, state.richTextEditorState.messageHtml) { state }
}.test {
val initialState = awaitFirstItem()
initialState.eventSink.invoke(MessageComposerEvents.SendUri(Uri.parse("content://uri")))
waitForPredicate { mediaPreProcessor.processCallCount == 1 }
}
}
@Test
fun `present - handle typing notice event`() = runTest {
val room = FakeMatrixRoom()