Skip to content

Instantly share code, notes, and snippets.

@dhruvtaneja
Created June 23, 2018 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dhruvtaneja/520607713468f53dbfcb55923671a835 to your computer and use it in GitHub Desktop.
Save dhruvtaneja/520607713468f53dbfcb55923671a835 to your computer and use it in GitHub Desktop.
app home viewmodel test
@Test
fun testIsTodoInHome() {
whenever(firebaseRemoteConfig.getString(AbTestingUtils.FirebaseParamKeys.AB_TEST_HOME_SCREEN_VERSION_ANDROID))
.thenReturn(AbTestingUtils.FirebaseParamValues.HOME_TODO)
assertThat(viewModel.isTodoInHome()).isTrue()
whenever(firebaseRemoteConfig.getString(AbTestingUtils.FirebaseParamKeys.AB_TEST_HOME_SCREEN_VERSION_ANDROID))
.thenReturn(AbTestingUtils.FirebaseParamValues.HOME_DEFAULT)
assertThat(viewModel.isTodoInHome())
.isFalse()
}
@Test
fun testUpdateTodoCards() {
viewModel.segmentsViewModels.add(getDummyAppSegmentViewModel1())
viewModel.segmentsViewModels.add(getDummyTodoCardViewModel1())
viewModel.segmentsViewModels.add(getDummyTodoCardViewModel1())
viewModel.segmentsViewModels.add(getDummyTodoCardViewModel1())
assertThat(viewModel.segmentsViewModels.size)
.isEqualTo(4)
val todoCards = ObservableArrayList<ItemViewModel>()
todoCards.add(getDummyTodoCardViewModel1())
viewModel.updateTodoCards(todoCards)
assertThat(viewModel.segmentsViewModels.size)
.isEqualTo(2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment