Test poll views state with enough number of options but without a question.

This commit is contained in:
Onuray Sahin 2022-06-13 15:58:13 +03:00
parent 5b35534c3d
commit 0bf37abca1
1 changed files with 14 additions and 0 deletions

View File

@ -25,6 +25,7 @@ import im.vector.app.features.poll.create.CreatePollViewStates.fakeQuestion
import im.vector.app.features.poll.create.CreatePollViewStates.initialCreatePollViewState
import im.vector.app.features.poll.create.CreatePollViewStates.pollViewStateWithOnlyQuestion
import im.vector.app.features.poll.create.CreatePollViewStates.pollViewStateWithQuestionAndNotEnoughOptions
import im.vector.app.features.poll.create.CreatePollViewStates.pollViewStateWithoutQuestionAndEnoughOptions
import im.vector.app.test.fakes.FakeSession
import im.vector.app.test.test
import org.junit.Rule
@ -79,4 +80,17 @@ class CreatePollViewModelTest {
.assertState(pollViewStateWithQuestionAndNotEnoughOptions)
.finish()
}
@Test
fun `given there is not a question when enough options are added then poll cannot be created and options can be added`() {
val createPollViewModel = createPollViewModel(PollMode.CREATE)
repeat(CreatePollViewModel.MIN_OPTIONS_COUNT) {
createPollViewModel.handle(CreatePollAction.OnOptionChanged(it, fakeOptions[it]))
}
createPollViewModel
.test()
.assertState(pollViewStateWithoutQuestionAndEnoughOptions)
.finish()
}
}