mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 19:36:08 +03:00
Test poll view state without enough options.
This commit is contained in:
parent
19de21535b
commit
5b35534c3d
1 changed files with 25 additions and 0 deletions
|
@ -54,4 +54,29 @@ class CreatePollViewModelTest {
|
|||
.assertState(initialCreatePollViewState)
|
||||
.finish()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `given there is not any options when the question is added then poll cannot be created and options can be added`() {
|
||||
val createPollViewModel = createPollViewModel(PollMode.CREATE)
|
||||
createPollViewModel.handle(CreatePollAction.OnQuestionChanged(fakeQuestion))
|
||||
|
||||
createPollViewModel
|
||||
.test()
|
||||
.assertState(pollViewStateWithOnlyQuestion)
|
||||
.finish()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `given there is not enough options when the question is added then poll cannot be created and options can be added`() {
|
||||
val createPollViewModel = createPollViewModel(PollMode.CREATE)
|
||||
createPollViewModel.handle(CreatePollAction.OnQuestionChanged(fakeQuestion))
|
||||
repeat(CreatePollViewModel.MIN_OPTIONS_COUNT - 1) {
|
||||
createPollViewModel.handle(CreatePollAction.OnOptionChanged(it, fakeOptions[it]))
|
||||
}
|
||||
|
||||
createPollViewModel
|
||||
.test()
|
||||
.assertState(pollViewStateWithQuestionAndNotEnoughOptions)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue