Skip to content

Commit 2d6be42

Browse files
committed
feature(space): add missing tests on SpaceEvents topic
1 parent bae8607 commit 2d6be42

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

features/space/impl/src/test/kotlin/io/element/android/features/space/impl/root/SpacePresenterTest.kt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class SpacePresenterTest {
6060
assertThat(state.hasMoreToLoad).isTrue()
6161
assertThat(state.joinActions).isEmpty()
6262
assertThat(state.acceptDeclineInviteState).isEqualTo(anAcceptDeclineInviteState())
63+
assertThat(state.topicViewerState).isEqualTo(TopicViewerState.Hidden)
6364
advanceUntilIdle()
6465
paginateResult.assertions().isCalledOnce()
6566
}
@@ -236,6 +237,24 @@ class SpacePresenterTest {
236237
}
237238
}
238239

240+
@Test
241+
fun `present - topic viewer state`() = runTest {
242+
val paginateResult = lambdaRecorder<Result<Unit>> {
243+
Result.success(Unit)
244+
}
245+
val spaceRoomList = FakeSpaceRoomList(paginateResult = paginateResult)
246+
val presenter = createSpacePresenter(spaceRoomList = spaceRoomList)
247+
presenter.test {
248+
val state = awaitItem()
249+
assertThat(state.topicViewerState).isEqualTo(TopicViewerState.Hidden)
250+
advanceUntilIdle()
251+
state.eventSink(SpaceEvents.ShowTopicViewer("topic"))
252+
assertThat(awaitItem().topicViewerState).isEqualTo(TopicViewerState.Shown("topic"))
253+
state.eventSink(SpaceEvents.HideTopicViewer)
254+
assertThat(awaitItem().topicViewerState).isEqualTo(TopicViewerState.Hidden)
255+
}
256+
}
257+
239258
@Test
240259
fun `present - accept invite is transmitted to acceptDeclineInviteState`() {
241260
`invite action is transmitted to acceptDeclineInviteState`(

0 commit comments

Comments
 (0)