Adds RoomSummaryFixture

This commit is contained in:
ericdecanini 2022-07-21 10:37:33 +02:00
parent f0ae458a54
commit 1d77f99148
2 changed files with 31 additions and 5 deletions

View file

@ -21,21 +21,19 @@ import im.vector.app.test.fakes.FakeActiveSessionHolder
import im.vector.app.test.fakes.FakeAnalyticsTracker
import im.vector.app.test.fakes.FakeSession
import im.vector.app.test.fakes.FakeUiStateRepository
import io.mockk.every
import im.vector.app.test.fixtures.RoomSummaryFixture.aRoomSummary
import io.mockk.justRun
import io.mockk.mockk
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.test.runTest
import org.amshove.kluent.shouldBe
import org.amshove.kluent.shouldBeEqualTo
import org.junit.Before
import org.junit.Test
import org.matrix.android.sdk.api.session.room.model.RoomSummary
internal class SpaceStateHandlerImplTest {
private val spaceId = "spaceId"
private val spaceSummary: RoomSummary = mockk()
private val spaceSummary = aRoomSummary(spaceId)
private val session = FakeSession.withRoomSummary(spaceSummary)
private val sessionDataSource = FakeActiveSessionDataSource()
@ -53,7 +51,6 @@ internal class SpaceStateHandlerImplTest {
@Before
fun setup() {
justRun { uiStateRepository.storeSelectedSpace(any(), any()) }
every { spaceSummary.roomId } returns spaceId
}
@Test

View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2022 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.test.fixtures
import org.matrix.android.sdk.api.session.room.model.RoomSummary
object RoomSummaryFixture {
fun aRoomSummary(roomId: String) = RoomSummary(
roomId,
isEncrypted = false,
encryptionEventTs = 0,
typingUsers = emptyList(),
)
}