Skip to content

Commit

Permalink
[WIP] Updates: the MySiteViewModelTest
Browse files Browse the repository at this point in the history
  • Loading branch information
AjeshRPai committed Mar 13, 2024
1 parent 02192d8 commit 42ec262
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ class MySiteViewModelTest : BaseUnitTest() {

verify(quickStartUtilsWrapper)
.startQuickStart(site.id, false, quickStartRepository.quickStartType, quickStartTracker)
// verify(mySiteSourceManager).refreshQuickStart()
verify(dashboardCardsViewModelSlice).startQuickStart(site)
}

@Test
Expand All @@ -425,7 +425,7 @@ class MySiteViewModelTest : BaseUnitTest() {

viewModel.onPostUploaded(postUploadedEvent)

// verify(mySiteSourceManager).refreshBloggingPrompts(true)
verify(dashboardCardsViewModelSlice).refreshBloggingPrompt()
}

@Test
Expand All @@ -450,13 +450,6 @@ class MySiteViewModelTest : BaseUnitTest() {
verify(analyticsTrackerWrapper, times(0)).track(Stat.MY_SITE_PULL_TO_REFRESH)
}

/* CLEARED */
@Test
fun `when vm cleared() is invoked, then MySiteSource clear() is invoked`() {
viewModel.invokeOnCleared()

// verify(mySiteSourceManager).clear()
}

/* LAND ON THE EDITOR A/B EXPERIMENT */
@Test
Expand Down Expand Up @@ -502,6 +495,17 @@ class MySiteViewModelTest : BaseUnitTest() {
assertThat(viewModel.onShowJetpackIndividualPluginOverlay.value?.peekContent()).isNull()
}


@Test
fun `when onCleared is called, then clears all the vm slices`() {
viewModel.invokeOnCleared()

verify(siteInfoHeaderCardViewModelSlice).onCleared()
verify(accountDataViewModelSlice).onCleared()
verify(dashboardCardsViewModelSlice).onCleared()
verify(dashboardItemsViewModelSlice).onCleared()
}

@Suppress("LongParameterList")
private fun initSelectedSite(
isQuickStartInProgress: Boolean = false,
Expand Down

0 comments on commit 42ec262

Please sign in to comment.