Skip to content

Commit

Permalink
↑ Updates: the naming of the function
Browse files Browse the repository at this point in the history
  • Loading branch information
AjeshRPai committed Mar 22, 2024
1 parent 23f9e5a commit b73b46d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class DashboardCardsViewModelSlice @Inject constructor(
jpMigrationSuccessCardViewModelSlice.buildCard()
jetpackInstallFullPluginCardViewModelSlice.buildCard(site)
blazeCardViewModelSlice.buildCard(site)
bloggingPromptCardViewModelSlice.buildCard(site)
bloggingPromptCardViewModelSlice.fetchBloggingPrompt(site)
bloganuaryNudgeCardViewModelSlice.buildCard()
personalizeCardViewModelSlice.buildCard()
quickLinksItemViewModelSlice.buildCard(site)
Expand Down Expand Up @@ -226,7 +226,7 @@ class DashboardCardsViewModelSlice @Inject constructor(

fun refreshBloggingPrompt() {
selectedSiteRepository.getSelectedSite()?.let {
bloggingPromptCardViewModelSlice.buildCard(it)
bloggingPromptCardViewModelSlice.fetchBloggingPrompt(it)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class BloggingPromptCardViewModelSlice @Inject constructor(

private lateinit var scope: CoroutineScope

fun buildCard(
fun fetchBloggingPrompt(
siteModel: SiteModel
) {
scope.launch(bgDispatcher) {
Expand Down Expand Up @@ -107,7 +107,7 @@ class BloggingPromptCardViewModelSlice @Inject constructor(
this.scope = scope
}

private fun buildCard(bloggingPromptUpdate: BloggingPromptModel): BloggingPromptCardWithData? {
private fun fetchBloggingPrompt(bloggingPromptUpdate: BloggingPromptModel): BloggingPromptCardWithData? {
return bloggingPromptCardBuilder.build(getBuilderParams(bloggingPromptUpdate))
}

Expand Down Expand Up @@ -191,7 +191,7 @@ class BloggingPromptCardViewModelSlice @Inject constructor(
private fun postState(bloggingPrompt: BloggingPromptModel?) {
_isRefreshing.postValue(false)
bloggingPrompt?.let {
buildCard(bloggingPrompt)?.let { card ->
fetchBloggingPrompt(bloggingPrompt)?.let { card ->
_uiModel.postValue(card)
}
} ?: _uiModel.postValue(null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class DashboardCardsViewModelSliceTest: BaseUnitTest() {
verify(jpMigrationSuccessCardViewModelSlice, atMost(1)).buildCard()
verify(jetpackInstallFullPluginCardViewModelSlice, atMost(1)).buildCard(mockSite)
verify(blazeCardViewModelSlice, atMost(1)).buildCard(mockSite)
verify(bloggingPromptCardViewModelSlice, atMost(1)).buildCard(mockSite)
verify(bloggingPromptCardViewModelSlice, atMost(1)).fetchBloggingPrompt(mockSite)
verify(bloganuaryNudgeCardViewModelSlice, atMost(1)).buildCard()
verify(personalizeCardViewModelSlice, atMost(1)).buildCard()
verify(quickLinksItemViewModelSlice, atMost(1)).buildCard(mockSite)
Expand Down Expand Up @@ -168,7 +168,7 @@ class DashboardCardsViewModelSliceTest: BaseUnitTest() {

dashboardCardsViewModelSlice.refreshBloggingPrompt()

verify(bloggingPromptCardViewModelSlice).buildCard(mockSite)
verify(bloggingPromptCardViewModelSlice).fetchBloggingPrompt(mockSite)
}

@Test
Expand Down

0 comments on commit b73b46d

Please sign in to comment.