Test poll view state without enough options.
This commit is contained in:
parent
19de21535b
commit
5b35534c3d
@ -54,4 +54,29 @@ class CreatePollViewModelTest {
|
|||||||
.assertState(initialCreatePollViewState)
|
.assertState(initialCreatePollViewState)
|
||||||
.finish()
|
.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…
x
Reference in New Issue
Block a user