mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Test synchronizes on profile persistence instead of advanceUntilIdle
This commit is contained in:
+4
-3
@@ -32,9 +32,9 @@ import io.element.android.services.toolbox.test.systemclock.FakeSystemClock
|
|||||||
import io.element.android.tests.testutils.lambda.lambdaRecorder
|
import io.element.android.tests.testutils.lambda.lambdaRecorder
|
||||||
import io.element.android.tests.testutils.lambda.value
|
import io.element.android.tests.testutils.lambda.value
|
||||||
import io.element.android.tests.testutils.testCoroutineDispatchers
|
import io.element.android.tests.testutils.testCoroutineDispatchers
|
||||||
|
import kotlinx.coroutines.CompletableDeferred
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.test.TestScope
|
import kotlinx.coroutines.test.TestScope
|
||||||
import kotlinx.coroutines.test.advanceUntilIdle
|
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.matrix.rustcomponents.sdk.Client
|
import org.matrix.rustcomponents.sdk.Client
|
||||||
@@ -72,7 +72,8 @@ class RustMatrixClientTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `retrieving the UserProfile updates the database`() = runTest {
|
fun `retrieving the UserProfile updates the database`() = runTest {
|
||||||
val updateUserProfileResult = lambdaRecorder<String, String?, String?, Unit> { _, _, _ -> }
|
val profilePersisted = CompletableDeferred<Unit>()
|
||||||
|
val updateUserProfileResult = lambdaRecorder<String, String?, String?, Unit> { _, _, _ -> profilePersisted.complete(Unit) }
|
||||||
val sessionStore = InMemorySessionStore(
|
val sessionStore = InMemorySessionStore(
|
||||||
initialList = listOf(
|
initialList = listOf(
|
||||||
aSessionData(
|
aSessionData(
|
||||||
@@ -97,7 +98,7 @@ class RustMatrixClientTest {
|
|||||||
),
|
),
|
||||||
sessionStore = sessionStore,
|
sessionStore = sessionStore,
|
||||||
)
|
)
|
||||||
advanceUntilIdle()
|
profilePersisted.await()
|
||||||
updateUserProfileResult.assertions().isCalledOnce()
|
updateUserProfileResult.assertions().isCalledOnce()
|
||||||
.with(
|
.with(
|
||||||
value(A_USER_ID.value),
|
value(A_USER_ID.value),
|
||||||
|
|||||||
Reference in New Issue
Block a user