Skip to content

Commit

Permalink
Update InsightsManagementMapperTest.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
ravishanker committed Feb 22, 2024
1 parent a51652d commit 0d23445
Showing 1 changed file with 47 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,7 @@ import org.mockito.Mock
import org.wordpress.android.BaseUnitTest
import org.wordpress.android.R
import org.wordpress.android.fluxc.store.StatsStore.InsightType
import org.wordpress.android.fluxc.store.StatsStore.InsightType.ALL_TIME_STATS
import org.wordpress.android.fluxc.store.StatsStore.InsightType.ANNUAL_SITE_STATS
import org.wordpress.android.fluxc.store.StatsStore.InsightType.FOLLOWERS
import org.wordpress.android.fluxc.store.StatsStore.InsightType.FOLLOWER_TOTALS
import org.wordpress.android.fluxc.store.StatsStore.InsightType.LATEST_POST_SUMMARY
import org.wordpress.android.fluxc.store.StatsStore.InsightType.MOST_POPULAR_DAY_AND_HOUR
import org.wordpress.android.fluxc.store.StatsStore.InsightType.POSTING_ACTIVITY
import org.wordpress.android.fluxc.store.StatsStore.InsightType.PUBLICIZE
import org.wordpress.android.fluxc.store.StatsStore.InsightType.TAGS_AND_CATEGORIES
import org.wordpress.android.fluxc.store.StatsStore.InsightType.*
import org.wordpress.android.ui.stats.refresh.lists.sections.insights.management.InsightsManagementViewModel.InsightListItem
import org.wordpress.android.ui.stats.refresh.lists.sections.insights.management.InsightsManagementViewModel.InsightListItem.Header
import org.wordpress.android.ui.stats.refresh.lists.sections.insights.management.InsightsManagementViewModel.InsightListItem.InsightModel
Expand All @@ -29,7 +21,7 @@ class InsightsManagementMapperTest : BaseUnitTest() {
private lateinit var trafficTabFeatureConfig: StatsTrafficTabFeatureConfig

private lateinit var insightsManagementMapper: InsightsManagementMapper
private var insightTypeCount = 9 // POSTS_AND_PAGES_INSIGHTS.size + ACTIVITY_INSIGHTS.size + GENERAL_INSIGHTS.size
private var insightTypeCount = 13 // POSTS_AND_PAGES_INSIGHTS.size + ACTIVITY_INSIGHTS.size + GENERAL_INSIGHTS.size
private val sectionsCount = 3

@Before
Expand All @@ -51,17 +43,21 @@ class InsightsManagementMapperTest : BaseUnitTest() {
// Then
assertThat(result).hasSize(insightTypeCount + sectionsCount)
assertHeader(result[0], R.string.stats_insights_management_general)
assertInsight(result[1], ALL_TIME_STATS, true)
assertInsight(result[2], MOST_POPULAR_DAY_AND_HOUR, true)
assertInsight(result[3], ANNUAL_SITE_STATS, true)
assertHeader(result[4], R.string.stats_insights_management_posts_and_pages)
assertInsight(result[5], LATEST_POST_SUMMARY, true)
assertInsight(result[6], POSTING_ACTIVITY, true)
assertInsight(result[7], TAGS_AND_CATEGORIES, true)
assertHeader(result[8], R.string.stats_insights_management_activity)
assertInsight(result[9], FOLLOWERS, true)
assertInsight(result[10], FOLLOWER_TOTALS, true)
assertInsight(result[11], PUBLICIZE, true)
assertInsight(result[1], VIEWS_AND_VISITORS, true)
assertInsight(result[2], ALL_TIME_STATS, true)
assertInsight(result[3], MOST_POPULAR_DAY_AND_HOUR, true)
assertInsight(result[4], ANNUAL_SITE_STATS, true)
assertInsight(result[5], TODAY_STATS, true)
assertHeader(result[6], R.string.stats_insights_management_posts_and_pages)
assertInsight(result[7], LATEST_POST_SUMMARY, true)
assertInsight(result[8], POSTING_ACTIVITY, true)
assertInsight(result[9], TAGS_AND_CATEGORIES, true)
assertHeader(result[10], R.string.stats_insights_management_activity)
assertInsight(result[11], FOLLOWERS, true)
assertInsight(result[12], TOTAL_LIKES, true)
assertInsight(result[13], TOTAL_COMMENTS, true)
assertInsight(result[14], TOTAL_FOLLOWERS, true)
assertInsight(result[15], PUBLICIZE, true)
}

@Test
Expand All @@ -75,17 +71,21 @@ class InsightsManagementMapperTest : BaseUnitTest() {
// Then
assertThat(result).hasSize(insightTypeCount + sectionsCount)
assertHeader(result[0], R.string.stats_insights_management_general)
assertInsight(result[1], ALL_TIME_STATS, true)
assertInsight(result[2], MOST_POPULAR_DAY_AND_HOUR, false)
assertInsight(result[3], ANNUAL_SITE_STATS, false)
assertHeader(result[4], R.string.stats_insights_management_posts_and_pages)
assertInsight(result[5], LATEST_POST_SUMMARY, false)
assertInsight(result[6], POSTING_ACTIVITY, false)
assertInsight(result[7], TAGS_AND_CATEGORIES, false)
assertHeader(result[8], R.string.stats_insights_management_activity)
assertInsight(result[9], FOLLOWERS, false)
assertInsight(result[10], FOLLOWER_TOTALS, false)
assertInsight(result[11], PUBLICIZE, true)
assertInsight(result[1], VIEWS_AND_VISITORS, false)
assertInsight(result[2], ALL_TIME_STATS, true)
assertInsight(result[3], MOST_POPULAR_DAY_AND_HOUR, false)
assertInsight(result[4], ANNUAL_SITE_STATS, false)
assertInsight(result[5], TODAY_STATS, false)
assertHeader(result[6], R.string.stats_insights_management_posts_and_pages)
assertInsight(result[7], LATEST_POST_SUMMARY, false)
assertInsight(result[8], POSTING_ACTIVITY, false)
assertInsight(result[9], TAGS_AND_CATEGORIES, false)
assertHeader(result[10], R.string.stats_insights_management_activity)
assertInsight(result[11], FOLLOWERS, false)
assertInsight(result[12], TOTAL_LIKES, false)
assertInsight(result[13], TOTAL_COMMENTS, false)
assertInsight(result[14], TOTAL_FOLLOWERS, false)
assertInsight(result[15], PUBLICIZE, true)
}

@Test
Expand All @@ -96,17 +96,21 @@ class InsightsManagementMapperTest : BaseUnitTest() {
// Then
assertThat(result).hasSize(insightTypeCount + sectionsCount)
assertHeader(result[0], R.string.stats_insights_management_general)
assertInsight(result[1], ALL_TIME_STATS, false)
assertInsight(result[2], MOST_POPULAR_DAY_AND_HOUR, false)
assertInsight(result[3], ANNUAL_SITE_STATS, false)
assertHeader(result[4], R.string.stats_insights_management_posts_and_pages)
assertInsight(result[5], LATEST_POST_SUMMARY, false)
assertInsight(result[6], POSTING_ACTIVITY, false)
assertInsight(result[7], TAGS_AND_CATEGORIES, false)
assertHeader(result[8], R.string.stats_insights_management_activity)
assertInsight(result[9], FOLLOWERS, false)
assertInsight(result[10], FOLLOWER_TOTALS, false)
assertInsight(result[11], PUBLICIZE, false)
assertInsight(result[1], VIEWS_AND_VISITORS, false)
assertInsight(result[2], ALL_TIME_STATS, false)
assertInsight(result[3], MOST_POPULAR_DAY_AND_HOUR, false)
assertInsight(result[4], ANNUAL_SITE_STATS, false)
assertInsight(result[5], TODAY_STATS, false)
assertHeader(result[6], R.string.stats_insights_management_posts_and_pages)
assertInsight(result[7], LATEST_POST_SUMMARY, false)
assertInsight(result[8], POSTING_ACTIVITY, false)
assertInsight(result[9], TAGS_AND_CATEGORIES, false)
assertHeader(result[10], R.string.stats_insights_management_activity)
assertInsight(result[11], FOLLOWERS, false)
assertInsight(result[12], TOTAL_LIKES, false)
assertInsight(result[13], TOTAL_COMMENTS, false)
assertInsight(result[14], TOTAL_FOLLOWERS, false)
assertInsight(result[15], PUBLICIZE, false)
}

private fun assertHeader(item: InsightListItem, text: Int) {
Expand Down

0 comments on commit 0d23445

Please sign in to comment.