From f26cddc875e2235234b738a4aa2182ae682a61e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 08:26:43 +0000 Subject: [PATCH 1/8] Bump androidx.navigation.safeargs.kotlin from 2.5.3 to 2.7.7 Bumps androidx.navigation.safeargs.kotlin from 2.5.3 to 2.7.7. --- updated-dependencies: - dependency-name: androidx.navigation.safeargs.kotlin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index 0dd34fb91ca1..b6b8018a0b2a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,7 +2,7 @@ pluginManagement { gradle.ext.kotlinVersion = '1.9.10' gradle.ext.agpVersion = '8.1.0' gradle.ext.googleServicesVersion = '4.3.15' - gradle.ext.navigationVersion = '2.5.3' + gradle.ext.navigationVersion = '2.7.7' gradle.ext.sentryVersion = '3.14.0' gradle.ext.daggerVersion = "2.46.1" gradle.ext.detektVersion = '1.23.0' From 8c2c169093cc5cec65aa57e26c90817fb3a440f2 Mon Sep 17 00:00:00 2001 From: Ravi Date: Thu, 22 Feb 2024 13:15:15 +1100 Subject: [PATCH 2/8] Update InsightsManagementMapper.kt Remove Today Stats from Insights when TrafficTab is enabled --- .../insights/management/InsightsManagementMapper.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapper.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapper.kt index 2ce68123cd8d..1c619ebec6f9 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapper.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapper.kt @@ -33,6 +33,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.insights.management import org.wordpress.android.ui.stats.refresh.lists.sections.insights.management.InsightsManagementViewModel.InsightListItem.InsightModel.Status.ADDED import org.wordpress.android.ui.stats.refresh.lists.sections.insights.management.InsightsManagementViewModel.InsightListItem.InsightModel.Status.REMOVED import org.wordpress.android.ui.utils.ListItemInteraction +import org.wordpress.android.util.config.StatsTrafficTabFeatureConfig import javax.inject.Inject import javax.inject.Named @@ -47,17 +48,23 @@ private val ACTIVITY_INSIGHTS = mutableListOf( private val GENERAL_INSIGHTS = mutableListOf( ALL_TIME_STATS, MOST_POPULAR_DAY_AND_HOUR, - ANNUAL_SITE_STATS, - TODAY_STATS + ANNUAL_SITE_STATS ) class InsightsManagementMapper @Inject constructor( - @Named(BG_THREAD) private val bgDispatcher: CoroutineDispatcher + @Named(BG_THREAD) private val bgDispatcher: CoroutineDispatcher, + private val trafficTabFeatureConfig: StatsTrafficTabFeatureConfig ) { suspend fun buildUIModel(addedTypes: Set, onClick: (InsightType) -> Unit) = withContext(bgDispatcher) { val insightListItems = mutableListOf() insightListItems += Header(R.string.stats_insights_management_general) + if (BuildConfig.IS_JETPACK_APP && + !trafficTabFeatureConfig.isEnabled() && + !GENERAL_INSIGHTS.contains(TODAY_STATS) + ) { + GENERAL_INSIGHTS.add(TODAY_STATS) + } if (BuildConfig.IS_JETPACK_APP && !GENERAL_INSIGHTS.contains(VIEWS_AND_VISITORS)) { GENERAL_INSIGHTS.add(0, VIEWS_AND_VISITORS) } From cb86656ea0f02942c585083e9470f5ce34121375 Mon Sep 17 00:00:00 2001 From: Ravi Date: Thu, 22 Feb 2024 13:16:26 +1100 Subject: [PATCH 3/8] Update StatsModule.kt Add Today Stats only when Traffic Tab is not enabled --- .../wordpress/android/ui/stats/refresh/StatsModule.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/StatsModule.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/StatsModule.kt index 08881ec68a44..407b7ab2b6fe 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/StatsModule.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/StatsModule.kt @@ -126,7 +126,8 @@ class StatsModule { managementNewsCardUseCase: ManagementNewsCardUseCase, actionCardGrowUseCase: ActionCardGrowUseCase, actionCardReminderUseCase: ActionCardReminderUseCase, - actionCardScheduleUseCase: ActionCardScheduleUseCase + actionCardScheduleUseCase: ActionCardScheduleUseCase, + trafficTabFeatureConfig: StatsTrafficTabFeatureConfig ): List<@JvmSuppressWildcards BaseStatsUseCase<*, *>> { val useCases = mutableListOf>() if (BuildConfig.IS_JETPACK_APP) { @@ -140,11 +141,15 @@ class StatsModule { } else { useCases.add(followerTotalsUseCase) } + + if (!trafficTabFeatureConfig.isEnabled()) { + useCases.add(todayStatsUseCase) + } + useCases.addAll( listOf( allTimeStatsUseCase, latestPostSummaryUseCase, - todayStatsUseCase, followersUseCaseFactory.build(BLOCK), commentsUseCase, mostPopularInsightsUseCase, From 88734d0e158b904cfd842c5f5f46d69751e62292 Mon Sep 17 00:00:00 2001 From: Ravi Date: Thu, 22 Feb 2024 15:57:35 +1100 Subject: [PATCH 4/8] Update InsightsManagementMapperTest.kt --- .../InsightsManagementMapperTest.kt | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapperTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapperTest.kt index b1b0a69db246..14e5bf6c057d 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapperTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapperTest.kt @@ -4,6 +4,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi import org.assertj.core.api.Assertions.assertThat import org.junit.Before import org.junit.Test +import org.mockito.Mock import org.wordpress.android.BaseUnitTest import org.wordpress.android.R import org.wordpress.android.fluxc.store.StatsStore.InsightType @@ -16,22 +17,26 @@ import org.wordpress.android.fluxc.store.StatsStore.InsightType.MOST_POPULAR_DAY 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.TODAY_STATS 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 import org.wordpress.android.ui.stats.refresh.lists.sections.insights.management.InsightsManagementViewModel.InsightListItem.InsightModel.Status +import org.wordpress.android.util.config.StatsTrafficTabFeatureConfig @ExperimentalCoroutinesApi class InsightsManagementMapperTest : BaseUnitTest() { + @Mock + private lateinit var trafficTabFeatureConfig: StatsTrafficTabFeatureConfig + private lateinit var insightsManagementMapper: InsightsManagementMapper - private val insightTypeCount = 10 // POSTS_AND_PAGES_INSIGHTS.size + ACTIVITY_INSIGHTS.size + GENERAL_INSIGHTS.size + private var insightTypeCount = 9 // POSTS_AND_PAGES_INSIGHTS.size + ACTIVITY_INSIGHTS.size + GENERAL_INSIGHTS.size private val sectionsCount = 3 @Before fun setUp() { insightsManagementMapper = InsightsManagementMapper( - testDispatcher() + testDispatcher(), + trafficTabFeatureConfig ) } @@ -49,15 +54,14 @@ class InsightsManagementMapperTest : BaseUnitTest() { assertInsight(result[1], ALL_TIME_STATS, true) assertInsight(result[2], MOST_POPULAR_DAY_AND_HOUR, true) assertInsight(result[3], ANNUAL_SITE_STATS, true) - assertInsight(result[4], TODAY_STATS, true) - assertHeader(result[5], R.string.stats_insights_management_posts_and_pages) - assertInsight(result[6], LATEST_POST_SUMMARY, true) - assertInsight(result[7], POSTING_ACTIVITY, true) - assertInsight(result[8], TAGS_AND_CATEGORIES, true) - assertHeader(result[9], R.string.stats_insights_management_activity) - assertInsight(result[10], FOLLOWERS, true) - assertInsight(result[11], FOLLOWER_TOTALS, true) - assertInsight(result[12], PUBLICIZE, 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) } @Test @@ -74,15 +78,14 @@ class InsightsManagementMapperTest : BaseUnitTest() { assertInsight(result[1], ALL_TIME_STATS, true) assertInsight(result[2], MOST_POPULAR_DAY_AND_HOUR, false) assertInsight(result[3], ANNUAL_SITE_STATS, false) - assertInsight(result[4], TODAY_STATS, false) - assertHeader(result[5], R.string.stats_insights_management_posts_and_pages) - assertInsight(result[6], LATEST_POST_SUMMARY, false) - assertInsight(result[7], POSTING_ACTIVITY, false) - assertInsight(result[8], TAGS_AND_CATEGORIES, false) - assertHeader(result[9], R.string.stats_insights_management_activity) - assertInsight(result[10], FOLLOWERS, false) - assertInsight(result[11], FOLLOWER_TOTALS, false) - assertInsight(result[12], PUBLICIZE, true) + 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) } @Test @@ -96,15 +99,14 @@ class InsightsManagementMapperTest : BaseUnitTest() { assertInsight(result[1], ALL_TIME_STATS, false) assertInsight(result[2], MOST_POPULAR_DAY_AND_HOUR, false) assertInsight(result[3], ANNUAL_SITE_STATS, false) - assertInsight(result[4], TODAY_STATS, false) - assertHeader(result[5], R.string.stats_insights_management_posts_and_pages) - assertInsight(result[6], LATEST_POST_SUMMARY, false) - assertInsight(result[7], POSTING_ACTIVITY, false) - assertInsight(result[8], TAGS_AND_CATEGORIES, false) - assertHeader(result[9], R.string.stats_insights_management_activity) - assertInsight(result[10], FOLLOWERS, false) - assertInsight(result[11], FOLLOWER_TOTALS, false) - assertInsight(result[12], PUBLICIZE, 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) } private fun assertHeader(item: InsightListItem, text: Int) { From 66e3191ed64a61d19bdc6423135d28ada7daf19d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 08:57:07 +0000 Subject: [PATCH 5/8] Bump mockitoVersion from 5.3.1 to 5.10.0 Bumps `mockitoVersion` from 5.3.1 to 5.10.0. Updates `org.mockito:mockito-core` from 5.3.1 to 5.10.0 - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](https://github.com/mockito/mockito/compare/v5.3.1...v5.10.0) Updates `org.mockito:mockito-android` from 5.3.1 to 5.10.0 - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](https://github.com/mockito/mockito/compare/v5.3.1...v5.10.0) --- updated-dependencies: - dependency-name: org.mockito:mockito-core dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.mockito:mockito-android dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index eba5484f157b..743b387e0d37 100644 --- a/build.gradle +++ b/build.gradle @@ -97,7 +97,7 @@ ext { // test assertjVersion = '3.23.1' junitVersion = '4.13.2' - mockitoVersion = '5.3.1' + mockitoVersion = '5.10.0' mockitoKotlinVersion = '4.1.0' // android test From a51652d9fb778ebba594a8faeeffcc15f243120d Mon Sep 17 00:00:00 2001 From: Ravi Date: Fri, 23 Feb 2024 08:11:56 +1100 Subject: [PATCH 6/8] Update InsightsManagementMapper.kt Remove IS_JETPACK_APP check since Stats only on Jetpack app now --- .../insights/management/InsightsManagementMapper.kt | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapper.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapper.kt index 1c619ebec6f9..d0f9ecfe1c45 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapper.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapper.kt @@ -2,7 +2,6 @@ package org.wordpress.android.ui.stats.refresh.lists.sections.insights.managemen import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.withContext -import org.wordpress.android.BuildConfig import org.wordpress.android.R import org.wordpress.android.fluxc.store.StatsStore.InsightType import org.wordpress.android.fluxc.store.StatsStore.InsightType.ACTION_GROW @@ -59,13 +58,10 @@ class InsightsManagementMapper @Inject constructor( withContext(bgDispatcher) { val insightListItems = mutableListOf() insightListItems += Header(R.string.stats_insights_management_general) - if (BuildConfig.IS_JETPACK_APP && - !trafficTabFeatureConfig.isEnabled() && - !GENERAL_INSIGHTS.contains(TODAY_STATS) - ) { + if (!trafficTabFeatureConfig.isEnabled() && !GENERAL_INSIGHTS.contains(TODAY_STATS)) { GENERAL_INSIGHTS.add(TODAY_STATS) } - if (BuildConfig.IS_JETPACK_APP && !GENERAL_INSIGHTS.contains(VIEWS_AND_VISITORS)) { + if (!GENERAL_INSIGHTS.contains(VIEWS_AND_VISITORS)) { GENERAL_INSIGHTS.add(0, VIEWS_AND_VISITORS) } insightListItems += GENERAL_INSIGHTS.map { type -> @@ -77,7 +73,7 @@ class InsightsManagementMapper @Inject constructor( } insightListItems += Header(R.string.stats_insights_management_activity) - if (BuildConfig.IS_JETPACK_APP && ACTIVITY_INSIGHTS.contains(FOLLOWER_TOTALS)) { + if (ACTIVITY_INSIGHTS.contains(FOLLOWER_TOTALS)) { // Replace FOLLOWER_TOTALS with Stats revamp v2 total insights val followerTotalsIndex = ACTIVITY_INSIGHTS.indexOf(FOLLOWER_TOTALS) ACTIVITY_INSIGHTS.remove(FOLLOWER_TOTALS) From 0d23445a026f225aec15dc4f131f82fc83be47d9 Mon Sep 17 00:00:00 2001 From: Ravi Date: Fri, 23 Feb 2024 09:59:25 +1100 Subject: [PATCH 7/8] Update InsightsManagementMapperTest.kt --- .../InsightsManagementMapperTest.kt | 90 ++++++++++--------- 1 file changed, 47 insertions(+), 43 deletions(-) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapperTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapperTest.kt index 14e5bf6c057d..e28a7479031d 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapperTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapperTest.kt @@ -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 @@ -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 @@ -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 @@ -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 @@ -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) { From cc8d3ca45ec9bf20168cd9f6a18f33cf7819af6b Mon Sep 17 00:00:00 2001 From: Ravi Date: Fri, 23 Feb 2024 10:12:43 +1100 Subject: [PATCH 8/8] Update InsightsManagementMapperTest.kt fix detekt warning about imports --- .../management/InsightsManagementMapperTest.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapperTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapperTest.kt index e28a7479031d..2e9df36f6232 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapperTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/management/InsightsManagementMapperTest.kt @@ -8,7 +8,19 @@ 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.* +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.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.TODAY_STATS +import org.wordpress.android.fluxc.store.StatsStore.InsightType.TOTAL_COMMENTS +import org.wordpress.android.fluxc.store.StatsStore.InsightType.TOTAL_FOLLOWERS +import org.wordpress.android.fluxc.store.StatsStore.InsightType.TOTAL_LIKES +import org.wordpress.android.fluxc.store.StatsStore.InsightType.VIEWS_AND_VISITORS 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