mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 01:45:52 +03:00
Moves UiStateRepository stubbing to fake class
This commit is contained in:
parent
1d77f99148
commit
d8fdaf0477
2 changed files with 5 additions and 7 deletions
|
@ -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()
|
||||
|
|
|
@ -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) }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue