From bd9179dd45354fb0bd3efabdf6fb6cad40a6a0dd Mon Sep 17 00:00:00 2001 From: ganfra Date: Thu, 26 Oct 2023 14:39:13 +0200 Subject: [PATCH] PIN : Fix SetupPinPresenterTest --- .../lockscreen/impl/setup/SetupPinPresenterTest.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/features/lockscreen/impl/src/test/kotlin/io/element/android/features/lockscreen/impl/setup/SetupPinPresenterTest.kt b/features/lockscreen/impl/src/test/kotlin/io/element/android/features/lockscreen/impl/setup/SetupPinPresenterTest.kt index 81c37e6d69..5b6e76fb06 100644 --- a/features/lockscreen/impl/src/test/kotlin/io/element/android/features/lockscreen/impl/setup/SetupPinPresenterTest.kt +++ b/features/lockscreen/impl/src/test/kotlin/io/element/android/features/lockscreen/impl/setup/SetupPinPresenterTest.kt @@ -30,6 +30,7 @@ import io.element.android.features.lockscreen.impl.setup.validation.PinValidator import io.element.android.features.lockscreen.impl.setup.validation.SetupPinFailure import io.element.android.libraries.matrix.test.core.aBuildMeta import io.element.android.tests.testutils.awaitLastSequentialItem +import io.element.android.tests.testutils.consumeItemsUntilPredicate import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.test.runTest import org.junit.Test @@ -77,7 +78,9 @@ class SetupPinPresenterTest { assertThat(state.setupPinFailure).isNull() state.eventSink(SetupPinEvents.OnPinEntryChanged(completePin)) } - awaitLastSequentialItem().also { state -> + consumeItemsUntilPredicate { + it.isConfirmationStep + }.last().also { state -> state.choosePinEntry.assertText(completePin) state.confirmPinEntry.assertEmpty() assertThat(state.isConfirmationStep).isTrue() @@ -96,7 +99,9 @@ class SetupPinPresenterTest { assertThat(state.setupPinFailure).isNull() state.eventSink(SetupPinEvents.OnPinEntryChanged(completePin)) } - awaitLastSequentialItem().also { state -> + consumeItemsUntilPredicate { + it.isConfirmationStep + }.last().also { state -> state.choosePinEntry.assertText(completePin) state.confirmPinEntry.assertEmpty() assertThat(state.isConfirmationStep).isTrue()