Fix undisclosed poll unit test.

This commit is contained in:
Onuray Sahin 2022-06-27 14:07:26 +03:00
parent 1a668da077
commit 6f4e079a2e
1 changed files with 18 additions and 6 deletions

View File

@ -145,16 +145,28 @@ class PollItemViewStateFactoryTest {
) )
} }
/*
@Test @Test
fun `given a sent poll when undisclosed poll type is selected then PollState is Undisclosed`() = runTest { fun `given a sent poll when undisclosed poll type is selected then poll is votable and option states are PollUndisclosed`() = runTest {
pollItemViewStateFactory.createPollState( val pollViewState = pollItemViewStateFactory.create(
informationData = A_MESSAGE_INFORMATION_DATA,
pollResponseSummary = A_POLL_RESPONSE_DATA,
pollContent = A_POLL_CONTENT, pollContent = A_POLL_CONTENT,
) shouldBe PollState.Undisclosed informationData = A_MESSAGE_INFORMATION_DATA,
)
pollViewState shouldBeEqualTo PollViewState(
question = A_POLL_CONTENT.getBestPollCreationInfo()?.question?.getBestQuestion() ?: "",
totalVotes = "",
canVote = true,
optionViewStates = A_POLL_CONTENT.getBestPollCreationInfo()?.answers?.map { answer ->
PollOptionViewState.PollUndisclosed(
optionId = answer.id ?: "",
optionAnswer = answer.getBestAnswer() ?: "",
isSelected = false
)
},
)
} }
/*
@Test @Test
fun `given a sent poll when my vote exists then PollState is Voted`() = runTest { fun `given a sent poll when my vote exists then PollState is Voted`() = runTest {
val votedPollData = A_POLL_RESPONSE_DATA.copy( val votedPollData = A_POLL_RESPONSE_DATA.copy(