mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 19:36:08 +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.FakeSession
|
||||||
import im.vector.app.test.fakes.FakeUiStateRepository
|
import im.vector.app.test.fakes.FakeUiStateRepository
|
||||||
import im.vector.app.test.fixtures.RoomSummaryFixture.aRoomSummary
|
import im.vector.app.test.fixtures.RoomSummaryFixture.aRoomSummary
|
||||||
import io.mockk.justRun
|
|
||||||
import kotlinx.coroutines.flow.first
|
import kotlinx.coroutines.flow.first
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.amshove.kluent.shouldBe
|
import org.amshove.kluent.shouldBe
|
||||||
import org.amshove.kluent.shouldBeEqualTo
|
import org.amshove.kluent.shouldBeEqualTo
|
||||||
import org.junit.Before
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
internal class SpaceStateHandlerImplTest {
|
internal class SpaceStateHandlerImplTest {
|
||||||
|
@ -48,11 +46,6 @@ internal class SpaceStateHandlerImplTest {
|
||||||
analyticsTracker,
|
analyticsTracker,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Before
|
|
||||||
fun setup() {
|
|
||||||
justRun { uiStateRepository.storeSelectedSpace(any(), any()) }
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `given selected space doesn't exist, when getCurrentSpace, then return null`() {
|
fun `given selected space doesn't exist, when getCurrentSpace, then return null`() {
|
||||||
val currentSpace = spaceStateHandler.getCurrentSpace()
|
val currentSpace = spaceStateHandler.getCurrentSpace()
|
||||||
|
|
|
@ -17,12 +17,17 @@
|
||||||
package im.vector.app.test.fakes
|
package im.vector.app.test.fakes
|
||||||
|
|
||||||
import im.vector.app.features.ui.UiStateRepository
|
import im.vector.app.features.ui.UiStateRepository
|
||||||
|
import io.mockk.justRun
|
||||||
import io.mockk.mockk
|
import io.mockk.mockk
|
||||||
import io.mockk.verify
|
import io.mockk.verify
|
||||||
import org.matrix.android.sdk.api.session.Session
|
import org.matrix.android.sdk.api.session.Session
|
||||||
|
|
||||||
class FakeUiStateRepository : UiStateRepository by mockk() {
|
class FakeUiStateRepository : UiStateRepository by mockk() {
|
||||||
|
|
||||||
|
init {
|
||||||
|
justRun { storeSelectedSpace(any(), any()) }
|
||||||
|
}
|
||||||
|
|
||||||
fun verifyStoreSelectedSpace(roomId: String, session: Session, inverse: Boolean = false) {
|
fun verifyStoreSelectedSpace(roomId: String, session: Session, inverse: Boolean = false) {
|
||||||
verify(inverse = inverse) { storeSelectedSpace(roomId, session.sessionId) }
|
verify(inverse = inverse) { storeSelectedSpace(roomId, session.sessionId) }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue