fix unit test
This commit is contained in:
parent
b59068b463
commit
2d335c1307
|
@ -19,6 +19,7 @@ package im.vector.app.core.device
|
||||||
import im.vector.app.test.fakes.FakeActiveSessionHolder
|
import im.vector.app.test.fakes.FakeActiveSessionHolder
|
||||||
import im.vector.app.test.fakes.FakeCryptoService
|
import im.vector.app.test.fakes.FakeCryptoService
|
||||||
import im.vector.app.test.fakes.FakeSession
|
import im.vector.app.test.fakes.FakeSession
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.amshove.kluent.shouldBeEqualTo
|
import org.amshove.kluent.shouldBeEqualTo
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ class DefaultGetDeviceInfoUseCaseTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `when execute, then get crypto device info`() {
|
fun `when execute, then get crypto device info`() {
|
||||||
val result = getDeviceInfoUseCase.execute()
|
val result = runBlocking { getDeviceInfoUseCase.execute() }
|
||||||
|
|
||||||
result shouldBeEqualTo cryptoService.cryptoDeviceInfo
|
result shouldBeEqualTo cryptoService.cryptoDeviceInfo
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import im.vector.app.test.fixtures.CryptoDeviceInfoFixture.aCryptoDeviceInfo
|
||||||
import im.vector.app.test.fixtures.PusherFixture
|
import im.vector.app.test.fixtures.PusherFixture
|
||||||
import im.vector.app.test.fixtures.SessionParamsFixture
|
import im.vector.app.test.fixtures.SessionParamsFixture
|
||||||
import io.mockk.mockk
|
import io.mockk.mockk
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.amshove.kluent.shouldBeEqualTo
|
import org.amshove.kluent.shouldBeEqualTo
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.matrix.android.sdk.api.session.crypto.model.UnsignedDeviceInfo
|
import org.matrix.android.sdk.api.session.crypto.model.UnsignedDeviceInfo
|
||||||
|
@ -80,7 +81,9 @@ class PushersManagerTest {
|
||||||
withEventIdOnly = true,
|
withEventIdOnly = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
runBlocking {
|
||||||
pushersManager.enqueueRegisterPusher(pushKey, gateway)
|
pushersManager.enqueueRegisterPusher(pushKey, gateway)
|
||||||
|
}
|
||||||
|
|
||||||
val httpPusher = pushersService.verifyEnqueueAddHttpPusher()
|
val httpPusher = pushersService.verifyEnqueueAddHttpPusher()
|
||||||
httpPusher shouldBeEqualTo expectedHttpPusher
|
httpPusher shouldBeEqualTo expectedHttpPusher
|
||||||
|
|
|
@ -84,5 +84,5 @@ class FakeCryptoService(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getMyCryptoDevice() = cryptoDeviceInfo
|
override suspend fun getMyCryptoDevice() = cryptoDeviceInfo
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package im.vector.app.test.fakes
|
package im.vector.app.test.fakes
|
||||||
|
|
||||||
import im.vector.app.core.device.GetDeviceInfoUseCase
|
import im.vector.app.core.device.GetDeviceInfoUseCase
|
||||||
|
import io.mockk.coEvery
|
||||||
import io.mockk.every
|
import io.mockk.every
|
||||||
import io.mockk.mockk
|
import io.mockk.mockk
|
||||||
import org.matrix.android.sdk.api.session.crypto.model.CryptoDeviceInfo
|
import org.matrix.android.sdk.api.session.crypto.model.CryptoDeviceInfo
|
||||||
|
@ -24,6 +25,6 @@ import org.matrix.android.sdk.api.session.crypto.model.CryptoDeviceInfo
|
||||||
class FakeGetDeviceInfoUseCase : GetDeviceInfoUseCase by mockk() {
|
class FakeGetDeviceInfoUseCase : GetDeviceInfoUseCase by mockk() {
|
||||||
|
|
||||||
fun givenDeviceInfo(cryptoDeviceInfo: CryptoDeviceInfo) {
|
fun givenDeviceInfo(cryptoDeviceInfo: CryptoDeviceInfo) {
|
||||||
every { execute() } returns cryptoDeviceInfo
|
coEvery { execute() } returns cryptoDeviceInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue