feat(home): 최근 활동 카드 이동을 연결한다
This commit is contained in:
@@ -23,10 +23,12 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.BuildConfig
|
||||
import kr.co.vividnext.sodalive.audio_content.detail.AudioContentDetailActivity
|
||||
import kr.co.vividnext.sodalive.audio_content.series.detail.SeriesDetailActivity
|
||||
import kr.co.vividnext.sodalive.common.Constants
|
||||
import kr.co.vividnext.sodalive.common.formatUtcRelativeTimeText
|
||||
import kr.co.vividnext.sodalive.explorer.profile.UserProfileActivity
|
||||
import kr.co.vividnext.sodalive.explorer.profile.creator_community.all.CreatorCommunityAllActivity
|
||||
import kr.co.vividnext.sodalive.settings.event.EventDetailActivity
|
||||
import kr.co.vividnext.sodalive.settings.event.EventItem
|
||||
import kr.co.vividnext.sodalive.v2.main.home.data.HomeActiveCreatorItem
|
||||
@@ -46,8 +48,13 @@ import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationLiveUiModel
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationPopularCommunityPostSection
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationPopularCommunityPostUiModel
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationPaidStatus
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationRecentlyActiveCreatorRoute
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationRecentlyActiveCreatorUiModel
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.RecommendedActivityType
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.toHomeRecommendationBannerIntent
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.toHomeRecommendationBannerRoute
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.toHomeRecommendationRecentlyActiveCreatorIntent
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.toHomeRecommendationRecentlyActiveCreatorRoute
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.visibleHomePopularCommunityPosts
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.visibleHomeGenreCreatorGroups
|
||||
import kr.co.vividnext.sodalive.v2.main.home.data.HomePopularCommunityPostItem
|
||||
@@ -992,6 +999,62 @@ class HomeMainFragmentLayoutTest {
|
||||
assertEquals(null, homeBanner(link = "mailto:test@example.com").toHomeRecommendationBannerRoute())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `home recent activity route maps activity type to target destination`() {
|
||||
assertEquals(
|
||||
HomeRecommendationRecentlyActiveCreatorRoute.AudioContent(11L),
|
||||
recentActivityCreator(RecommendedActivityType.LiveReplay, targetId = 11L)
|
||||
.toHomeRecommendationRecentlyActiveCreatorRoute()
|
||||
)
|
||||
assertEquals(
|
||||
HomeRecommendationRecentlyActiveCreatorRoute.AudioContent(12L),
|
||||
recentActivityCreator(RecommendedActivityType.Audio, targetId = 12L)
|
||||
.toHomeRecommendationRecentlyActiveCreatorRoute()
|
||||
)
|
||||
assertEquals(
|
||||
HomeRecommendationRecentlyActiveCreatorRoute.Community(13L),
|
||||
recentActivityCreator(RecommendedActivityType.Community, targetId = 13L)
|
||||
.toHomeRecommendationRecentlyActiveCreatorRoute()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `home recent activity route ignores live unknown and missing target`() {
|
||||
assertEquals(
|
||||
null,
|
||||
recentActivityCreator(RecommendedActivityType.Live, targetId = 10L)
|
||||
.toHomeRecommendationRecentlyActiveCreatorRoute()
|
||||
)
|
||||
assertEquals(
|
||||
null,
|
||||
recentActivityCreator(activityType = null, targetId = 10L).toHomeRecommendationRecentlyActiveCreatorRoute()
|
||||
)
|
||||
assertEquals(
|
||||
null,
|
||||
recentActivityCreator(RecommendedActivityType.Audio, targetId = null)
|
||||
.toHomeRecommendationRecentlyActiveCreatorRoute()
|
||||
)
|
||||
assertEquals(
|
||||
null,
|
||||
recentActivityCreator(RecommendedActivityType.Community, targetId = 0L)
|
||||
.toHomeRecommendationRecentlyActiveCreatorRoute()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `home recent activity route creates expected intents`() {
|
||||
val context = ApplicationProvider.getApplicationContext<Context>()
|
||||
val audioIntent = HomeRecommendationRecentlyActiveCreatorRoute.AudioContent(11L)
|
||||
.toHomeRecommendationRecentlyActiveCreatorIntent(context)
|
||||
val communityIntent = HomeRecommendationRecentlyActiveCreatorRoute.Community(13L)
|
||||
.toHomeRecommendationRecentlyActiveCreatorIntent(context)
|
||||
|
||||
assertEquals(AudioContentDetailActivity::class.java.name, audioIntent.component?.className)
|
||||
assertEquals(11L, audioIntent.getLongExtra(Constants.EXTRA_AUDIO_CONTENT_ID, 0L))
|
||||
assertEquals(CreatorCommunityAllActivity::class.java.name, communityIntent.component?.className)
|
||||
assertEquals(13L, communityIntent.getLongExtra(Constants.EXTRA_COMMUNITY_CREATOR_ID, 0L))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `home popular community adapter does not load original image for locked paid post`() {
|
||||
val context = ApplicationProvider.getApplicationContext<Context>()
|
||||
@@ -1356,6 +1419,20 @@ class HomeMainFragmentLayoutTest {
|
||||
)
|
||||
}
|
||||
|
||||
private fun recentActivityCreator(
|
||||
activityType: RecommendedActivityType?,
|
||||
targetId: Long?
|
||||
): HomeRecommendationRecentlyActiveCreatorUiModel {
|
||||
return HomeRecommendationRecentlyActiveCreatorUiModel(
|
||||
nickname = "크리에이터",
|
||||
profileImage = "",
|
||||
activityType = activityType,
|
||||
activityLabelResId = activityType?.labelResId,
|
||||
activityAt = "방금 전",
|
||||
targetId = targetId
|
||||
)
|
||||
}
|
||||
|
||||
private fun popularCommunityData(
|
||||
audioUrl: String?,
|
||||
createdAt: String = "2분 전"
|
||||
|
||||
Reference in New Issue
Block a user