From 2c19ee6f8e540e1adfc8db40a1a90c58d8da34f2 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 8 Feb 2023 16:05:21 +0100 Subject: [PATCH] Improve coverage of `TemplatePresenter` --- .../features/template/TemplatePresenterTests.kt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/features/template/src/test/kotlin/io/element/android/features/template/TemplatePresenterTests.kt b/features/template/src/test/kotlin/io/element/android/features/template/TemplatePresenterTests.kt index 34cc73ba53..a14cd2761e 100644 --- a/features/template/src/test/kotlin/io/element/android/features/template/TemplatePresenterTests.kt +++ b/features/template/src/test/kotlin/io/element/android/features/template/TemplatePresenterTests.kt @@ -21,7 +21,7 @@ package io.element.android.features.template import app.cash.molecule.RecompositionClock import app.cash.molecule.moleculeFlow import app.cash.turbine.test -import com.google.common.truth.Truth +import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Test @@ -29,15 +29,24 @@ import org.junit.Test class TemplatePresenterTests { @Test - fun `present - `() = runTest { - + fun `present - initial state`() = runTest { val presenter = TemplatePresenter() moleculeFlow(RecompositionClock.Immediate) { presenter.present() }.test { val initialState = awaitItem() - Truth.assertThat(initialState) + assertThat(initialState) } + } + @Test + fun `present - send event`() = runTest { + val presenter = TemplatePresenter() + moleculeFlow(RecompositionClock.Immediate) { + presenter.present() + }.test { + val initialState = awaitItem() + initialState.eventSink.invoke(TemplateEvents.MyEvent) + } } }