Moves UiStateRepository stubbing to fake class

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

View file

@ -22,12 +22,10 @@ import im.vector.app.test.fakes.FakeAnalyticsTracker
import im.vector.app.test.fakes.FakeSession
import im.vector.app.test.fakes.FakeUiStateRepository
import im.vector.app.test.fixtures.RoomSummaryFixture.aRoomSummary
import io.mockk.justRun
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
internal class SpaceStateHandlerImplTest {
@ -48,11 +46,6 @@ internal class SpaceStateHandlerImplTest {
analyticsTracker,
)
@Before
fun setup() {
justRun { uiStateRepository.storeSelectedSpace(any(), any()) }
}
@Test
fun `given selected space doesn't exist, when getCurrentSpace, then return null`() {
val currentSpace = spaceStateHandler.getCurrentSpace()

View file

@ -17,12 +17,17 @@
package im.vector.app.test.fakes
import im.vector.app.features.ui.UiStateRepository
import io.mockk.justRun
import io.mockk.mockk
import io.mockk.verify
import org.matrix.android.sdk.api.session.Session
class FakeUiStateRepository : UiStateRepository by mockk() {
init {
justRun { storeSelectedSpace(any(), any()) }
}
fun verifyStoreSelectedSpace(roomId: String, session: Session, inverse: Boolean = false) {
verify(inverse = inverse) { storeSelectedSpace(roomId, session.sessionId) }
}