From 0f0492db3b21eaf69daac418560d6f22e17d4436 Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Wed, 22 Jun 2022 15:27:04 +0300 Subject: [PATCH] Test ready option view states. --- .../timeline/factory/PollItemFactoryTest.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/vector/src/test/java/im/vector/app/features/home/room/detail/timeline/factory/PollItemFactoryTest.kt b/vector/src/test/java/im/vector/app/features/home/room/detail/timeline/factory/PollItemFactoryTest.kt index d7cd757a39..02a24d8ca7 100644 --- a/vector/src/test/java/im/vector/app/features/home/room/detail/timeline/factory/PollItemFactoryTest.kt +++ b/vector/src/test/java/im/vector/app/features/home/room/detail/timeline/factory/PollItemFactoryTest.kt @@ -185,4 +185,19 @@ class PollItemFactoryTest { } } } + + @Test + fun `given a sent poll then all option view states is PollReady`() = runTest { + with(pollItemFactory) { + A_POLL_CONTENT + .getBestPollCreationInfo() + ?.answers + ?.mapToOptions(PollState.Sending, A_MESSAGE_INFORMATION_DATA) + ?.forEachIndexed { index, pollOptionViewState -> + A_POLL_CONTENT.getBestPollCreationInfo()?.answers?.get(index)?.let { option -> + pollOptionViewState shouldBeEqualTo PollOptionViewState.PollSending(option.id ?: "", option.getBestAnswer() ?: "") + } + } + } + } }