test(creator): 채널 홈 매퍼 검증을 보강한다
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package kr.co.vividnext.sodalive.v2.creator.channel
|
||||
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.v2.common.CreatorActivityType
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelActivityResponse
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelAudioContentResponse
|
||||
@@ -37,8 +38,16 @@ class CreatorChannelHomeMapperTest {
|
||||
assertTrue(content.header.isAiChatAvailable)
|
||||
assertTrue(content.header.isDmAvailable)
|
||||
assertEquals(
|
||||
listOf("홈", "라이브", "오디오", "시리즈", "커뮤니티", "팬Talk", "후원"),
|
||||
content.tabs.map(CreatorChannelTab::label)
|
||||
listOf(
|
||||
R.string.creator_channel_tab_home,
|
||||
R.string.creator_channel_tab_live,
|
||||
R.string.creator_channel_tab_audio,
|
||||
R.string.creator_channel_tab_series,
|
||||
R.string.creator_channel_tab_community,
|
||||
R.string.creator_channel_tab_fantalk,
|
||||
R.string.creator_channel_tab_donation
|
||||
),
|
||||
content.tabs.map(CreatorChannelTab::labelResId)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -97,6 +106,47 @@ class CreatorChannelHomeMapperTest {
|
||||
assertEquals(listOf("https://instagram.example", "https://youtube.example"), sns.items.map { it.url })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `SNS는 Figma 순서로 매핑하고 유효하지 않은 URL은 제외한다`() {
|
||||
val content = response(
|
||||
sns = CreatorChannelSnsResponse(
|
||||
instagramUrl = "https://instagram.example",
|
||||
fancimmUrl = "https://fancimm.example",
|
||||
xUrl = "not-a-url",
|
||||
youtubeUrl = "https://youtube.example",
|
||||
kakaoOpenChatUrl = "kakao-open-chat"
|
||||
)
|
||||
).toUiContent()
|
||||
|
||||
val sns = content.sections.filterIsInstance<CreatorChannelHomeSection.Sns>().single()
|
||||
|
||||
assertEquals(listOf("Instagram", "YouTube", "Fancimm"), sns.items.map { it.label })
|
||||
assertEquals(
|
||||
listOf("https://instagram.example", "https://youtube.example", "https://fancimm.example"),
|
||||
sns.items.map { it.url }
|
||||
)
|
||||
assertEquals(
|
||||
listOf(R.drawable.ic_sns_instagram, R.drawable.ic_sns_youtube, R.drawable.ic_sns_fancimm),
|
||||
sns.items.map { it.iconResId }
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `스케줄은 scheduledAtUtc가 가까운 순으로 최대 3개만 매핑한다`() {
|
||||
val content = response(
|
||||
schedules = listOf(
|
||||
schedule(id = 4L, scheduledAtUtc = "2026-06-12T13:00:00Z"),
|
||||
schedule(id = 2L, scheduledAtUtc = "2026-06-12T11:00:00Z"),
|
||||
schedule(id = 1L, scheduledAtUtc = "2026-06-12T10:00:00Z"),
|
||||
schedule(id = 3L, scheduledAtUtc = "2026-06-12T12:00:00Z")
|
||||
)
|
||||
).toUiContent()
|
||||
|
||||
val schedules = content.sections.filterIsInstance<CreatorChannelHomeSection.Schedules>().single()
|
||||
|
||||
assertEquals(listOf(1L, 2L, 3L), schedules.schedules.map { it.targetId })
|
||||
}
|
||||
|
||||
private fun response(
|
||||
currentLive: CreatorChannelLiveResponse? = live(),
|
||||
latestAudioContent: CreatorChannelAudioContentResponse? = audioContent(10L),
|
||||
@@ -174,11 +224,15 @@ class CreatorChannelHomeMapperTest {
|
||||
createdAtUtc = "2026-06-11T12:00:00Z"
|
||||
)
|
||||
|
||||
private fun schedule() = CreatorChannelScheduleResponse(
|
||||
scheduledAtUtc = "2026-06-12T12:00:00Z",
|
||||
title = "일정",
|
||||
type = CreatorActivityType.Live,
|
||||
targetId = 1L
|
||||
private fun schedule(
|
||||
id: Long = 1L,
|
||||
scheduledAtUtc: String = "2026-06-12T12:00:00Z",
|
||||
type: CreatorActivityType = CreatorActivityType.Live
|
||||
) = CreatorChannelScheduleResponse(
|
||||
scheduledAtUtc = scheduledAtUtc,
|
||||
title = "일정 $id",
|
||||
type = type,
|
||||
targetId = id
|
||||
)
|
||||
|
||||
private fun series() = CreatorChannelSeriesResponse(
|
||||
|
||||
Reference in New Issue
Block a user