From 2be43e929435ff665167c574e89ff0e94896db91 Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Wed, 22 Jun 2022 17:18:17 +0300 Subject: [PATCH] Test isVotable function. --- .../detail/timeline/factory/PollItemFactoryTest.kt | 14 ++++++++++++++ 1 file changed, 14 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 6c4f9e872e..be397e25ea 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 @@ -265,4 +265,18 @@ class PollItemFactoryTest { } } } + + @Test + fun `given a poll state when it is not Sending and not Ended then the poll is votable`() = runTest { + val sendingPollState = PollState.Sending + sendingPollState.isVotable() shouldBe false + val readyPollState = PollState.Ready + readyPollState.isVotable() shouldBe true + val votedPollState = PollState.Voted(1) + votedPollState.isVotable() shouldBe true + val undisclosedPollState = PollState.Undisclosed + undisclosedPollState.isVotable() shouldBe true + var endedPollState = PollState.Ended + endedPollState.isVotable() shouldBe false + } }