mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 10:32:34 +00:00
Add missing test for AnnouncementEvent.Continue
This commit is contained in:
+23
@@ -14,6 +14,7 @@ import io.element.android.features.announcement.impl.store.AnnouncementStatus
|
|||||||
import io.element.android.features.announcement.impl.store.AnnouncementStore
|
import io.element.android.features.announcement.impl.store.AnnouncementStore
|
||||||
import io.element.android.features.announcement.impl.store.InMemoryAnnouncementStore
|
import io.element.android.features.announcement.impl.store.InMemoryAnnouncementStore
|
||||||
import io.element.android.tests.testutils.test
|
import io.element.android.tests.testutils.test
|
||||||
|
import kotlinx.coroutines.flow.first
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@@ -44,6 +45,28 @@ class AnnouncementPresenterTest {
|
|||||||
assertThat(finalState.announcement).isNull()
|
assertThat(finalState.announcement).isNull()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `present - continue event will mark the announcement as Shown`() = runTest {
|
||||||
|
val store = InMemoryAnnouncementStore()
|
||||||
|
val presenter = createAnnouncementPresenter(
|
||||||
|
announcementStore = store,
|
||||||
|
)
|
||||||
|
presenter.test {
|
||||||
|
val state = awaitItem()
|
||||||
|
assertThat(state.announcement).isNull()
|
||||||
|
store.setAnnouncementStatus(Announcement.Fullscreen.Space, AnnouncementStatus.Show)
|
||||||
|
val statusShow = store.announcementStatusFlow(Announcement.Fullscreen.Space).first()
|
||||||
|
assertThat(statusShow).isEqualTo(AnnouncementStatus.Show)
|
||||||
|
val updatedState = awaitItem()
|
||||||
|
assertThat(updatedState.announcement).isEqualTo(Announcement.Fullscreen.Space)
|
||||||
|
updatedState.eventSink(AnnouncementEvent.Continue(Announcement.Fullscreen.Space))
|
||||||
|
val statusShown = store.announcementStatusFlow(Announcement.Fullscreen.Space).first()
|
||||||
|
assertThat(statusShown).isEqualTo(AnnouncementStatus.Shown)
|
||||||
|
val finalState = awaitItem()
|
||||||
|
assertThat(finalState.announcement).isNull()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createAnnouncementPresenter(
|
private fun createAnnouncementPresenter(
|
||||||
|
|||||||
Reference in New Issue
Block a user