@@ -45,10 +45,10 @@ import io.element.android.libraries.matrix.test.A_USER_ID
4545import io.element.android.libraries.matrix.test.A_USER_ID_2
4646import io.element.android.libraries.matrix.test.FakeMatrixClient
4747import io.element.android.libraries.matrix.test.core.aBuildMeta
48+ import io.element.android.libraries.matrix.test.room.aRoomInfo
4849import io.element.android.libraries.matrix.test.room.aRoomMember
4950import io.element.android.libraries.matrix.test.room.aRoomPreview
5051import io.element.android.libraries.matrix.test.room.aRoomPreviewInfo
51- import io.element.android.libraries.matrix.test.room.aRoomSummary
5252import io.element.android.libraries.matrix.test.room.join.FakeJoinRoom
5353import io.element.android.libraries.matrix.ui.model.InviteSender
5454import io.element.android.libraries.matrix.ui.model.toInviteSender
@@ -88,12 +88,12 @@ class JoinRoomPresenterTest {
8888
8989 @Test
9090 fun `present - when room is joined then content state is filled with his data` () = runTest {
91- val roomSummary = aRoomSummary ()
91+ val roomInfo = aRoomInfo ()
9292 val matrixClient = FakeMatrixClient (
9393 getNotJoinedRoomResult = { _, _ -> Result .failure(AN_EXCEPTION ) },
9494 ).apply {
95- getRoomSummaryFlowLambda = { _ ->
96- flowOf(Optional .of(roomSummary ))
95+ getRoomInfoFlowLambda = { _ ->
96+ flowOf(Optional .of(roomInfo ))
9797 }
9898 }
9999 val presenter = createJoinRoomPresenter(
@@ -104,58 +104,58 @@ class JoinRoomPresenterTest {
104104 awaitItem().also { state ->
105105 val contentState = state.contentState as ContentState .Loaded
106106 assertThat(contentState.roomId).isEqualTo(A_ROOM_ID )
107- assertThat(contentState.name).isEqualTo(roomSummary.info .name)
108- assertThat(contentState.topic).isEqualTo(roomSummary.info .topic)
109- assertThat(contentState.alias).isEqualTo(roomSummary.info .canonicalAlias)
110- assertThat(contentState.numberOfMembers).isEqualTo(roomSummary.info .joinedMembersCount)
111- assertThat(contentState.isDm).isEqualTo(roomSummary.info .isDirect)
112- assertThat(contentState.roomAvatarUrl).isEqualTo(roomSummary.info .avatarUrl)
107+ assertThat(contentState.name).isEqualTo(roomInfo .name)
108+ assertThat(contentState.topic).isEqualTo(roomInfo .topic)
109+ assertThat(contentState.alias).isEqualTo(roomInfo .canonicalAlias)
110+ assertThat(contentState.numberOfMembers).isEqualTo(roomInfo .joinedMembersCount)
111+ assertThat(contentState.isDm).isEqualTo(roomInfo .isDirect)
112+ assertThat(contentState.roomAvatarUrl).isEqualTo(roomInfo .avatarUrl)
113113 }
114114 }
115115 }
116116
117117 @Test
118118 fun `present - when room is invited then join authorization is equal to invited` () = runTest {
119- val roomSummary = aRoomSummary (currentUserMembership = CurrentUserMembership .INVITED )
119+ val roomInfo = aRoomInfo (currentUserMembership = CurrentUserMembership .INVITED )
120120 val matrixClient = FakeMatrixClient (
121121 getNotJoinedRoomResult = { _, _ -> Result .failure(AN_EXCEPTION ) },
122122 ).apply {
123- getRoomSummaryFlowLambda = { _ ->
124- flowOf(Optional .of(roomSummary ))
123+ getRoomInfoFlowLambda = { _ ->
124+ flowOf(Optional .of(roomInfo ))
125125 }
126126 }
127127 val seenInvitesStore = InMemorySeenInvitesStore ()
128128 val presenter = createJoinRoomPresenter(
129129 matrixClient = matrixClient,
130130 seenInvitesStore = seenInvitesStore,
131131 )
132- val inviteData = roomSummary.info .toInviteData()
132+ val inviteData = roomInfo .toInviteData()
133133 assertThat(seenInvitesStore.seenRoomIds().first()).isEmpty()
134134 presenter.test {
135135 skipItems(2 )
136136 awaitItem().also { state ->
137137 assertThat(state.joinAuthorisationStatus).isEqualTo(JoinAuthorisationStatus .IsInvited (inviteData, null ))
138138 }
139139 // Check that the roomId is stored in the seen invites store
140- assertThat(seenInvitesStore.seenRoomIds().first()).containsExactly(roomSummary.roomId )
140+ assertThat(seenInvitesStore.seenRoomIds().first()).containsExactly(roomInfo.id )
141141 }
142142 }
143143
144144 @Test
145145 fun `present - when room is invited then join authorization is equal to invited, an inviter is provided` () = runTest {
146146 val inviter = aRoomMember(userId = UserId (" @bob:example.com" ), displayName = " Bob" )
147147 val expectedInviteSender = inviter.toInviteSender()
148- val roomSummary = aRoomSummary (
148+ val roomInfo = aRoomInfo (
149149 currentUserMembership = CurrentUserMembership .INVITED ,
150150 joinedMembersCount = 5 ,
151151 inviter = inviter,
152152 )
153- val inviteData = roomSummary.info .toInviteData()
153+ val inviteData = roomInfo .toInviteData()
154154 val matrixClient = FakeMatrixClient (
155155 getNotJoinedRoomResult = { _, _ -> Result .failure(AN_EXCEPTION ) },
156156 ).apply {
157- getRoomSummaryFlowLambda = { _ ->
158- flowOf(Optional .of(roomSummary ))
157+ getRoomInfoFlowLambda = { _ ->
158+ flowOf(Optional .of(roomInfo ))
159159 }
160160 }
161161 val presenter = createJoinRoomPresenter(
@@ -172,7 +172,7 @@ class JoinRoomPresenterTest {
172172
173173 @Test
174174 fun `present - when room is invited read the number of member from the room preview` () = runTest {
175- val roomSummary = aRoomSummary (
175+ val roomInfo = aRoomInfo (
176176 currentUserMembership = CurrentUserMembership .INVITED ,
177177 // It seems that the SDK does not provide this value.
178178 joinedMembersCount = 0 ,
@@ -188,8 +188,8 @@ class JoinRoomPresenterTest {
188188 )
189189 },
190190 ).apply {
191- getRoomSummaryFlowLambda = { _ ->
192- flowOf(Optional .of(roomSummary ))
191+ getRoomInfoFlowLambda = { _ ->
192+ flowOf(Optional .of(roomInfo ))
193193 }
194194 }
195195 val presenter = createJoinRoomPresenter(
@@ -209,13 +209,13 @@ class JoinRoomPresenterTest {
209209 val acceptDeclinePresenter = Presenter {
210210 anAcceptDeclineInviteState(eventSink = eventSinkRecorder)
211211 }
212- val roomSummary = aRoomSummary (currentUserMembership = CurrentUserMembership .INVITED )
212+ val roomInfo = aRoomInfo (currentUserMembership = CurrentUserMembership .INVITED )
213213 val matrixClient = FakeMatrixClient ().apply {
214- getRoomSummaryFlowLambda = { _ ->
215- flowOf(Optional .of(roomSummary ))
214+ getRoomInfoFlowLambda = { _ ->
215+ flowOf(Optional .of(roomInfo ))
216216 }
217217 }
218- val inviteData = roomSummary.info .toInviteData()
218+ val inviteData = roomInfo .toInviteData()
219219 val presenter = createJoinRoomPresenter(
220220 matrixClient = matrixClient,
221221 acceptDeclineInvitePresenter = acceptDeclinePresenter
@@ -324,7 +324,7 @@ class JoinRoomPresenterTest {
324324
325325 @Test
326326 fun `present - when room is banned, then join authorization is equal to IsBanned` () = runTest {
327- val roomSummary = aRoomSummary (currentUserMembership = CurrentUserMembership .BANNED , joinRule = JoinRule .Public )
327+ val roomInfo = aRoomInfo (currentUserMembership = CurrentUserMembership .BANNED , joinRule = JoinRule .Public )
328328 val matrixClient = FakeMatrixClient (
329329 getNotJoinedRoomResult = { _, _ ->
330330 Result .success(
@@ -346,8 +346,8 @@ class JoinRoomPresenterTest {
346346 )
347347 }
348348 ).apply {
349- getRoomSummaryFlowLambda = { _ ->
350- flowOf(Optional .of(roomSummary ))
349+ getRoomInfoFlowLambda = { _ ->
350+ flowOf(Optional .of(roomInfo ))
351351 }
352352 }
353353 val presenter = createJoinRoomPresenter(
@@ -369,12 +369,12 @@ class JoinRoomPresenterTest {
369369
370370 @Test
371371 fun `present - when room is left and public then join authorization is equal to canJoin` () = runTest {
372- val roomSummary = aRoomSummary (currentUserMembership = CurrentUserMembership .LEFT , joinRule = JoinRule .Public )
372+ val roomInfo = aRoomInfo (currentUserMembership = CurrentUserMembership .LEFT , joinRule = JoinRule .Public )
373373 val matrixClient = FakeMatrixClient (
374374 getNotJoinedRoomResult = { _, _ -> Result .failure(AN_EXCEPTION ) },
375375 ).apply {
376- getRoomSummaryFlowLambda = { _ ->
377- flowOf(Optional .of(roomSummary ))
376+ getRoomInfoFlowLambda = { _ ->
377+ flowOf(Optional .of(roomInfo ))
378378 }
379379 }
380380 val presenter = createJoinRoomPresenter(
@@ -390,12 +390,12 @@ class JoinRoomPresenterTest {
390390
391391 @Test
392392 fun `present - when room is left and join rule null then join authorization is equal to Unknown` () = runTest {
393- val roomSummary = aRoomSummary (currentUserMembership = CurrentUserMembership .LEFT , joinRule = null )
393+ val roomInfo = aRoomInfo (currentUserMembership = CurrentUserMembership .LEFT , joinRule = null )
394394 val matrixClient = FakeMatrixClient (
395395 getNotJoinedRoomResult = { _, _ -> Result .failure(AN_EXCEPTION ) },
396396 ).apply {
397- getRoomSummaryFlowLambda = { _ ->
398- flowOf(Optional .of(roomSummary ))
397+ getRoomInfoFlowLambda = { _ ->
398+ flowOf(Optional .of(roomInfo ))
399399 }
400400 }
401401 val presenter = createJoinRoomPresenter(
0 commit comments