feat(creator): 채널 홈 API 모델을 추가한다
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
package kr.co.vividnext.sodalive.v2.creator.channel
|
||||
|
||||
import com.google.gson.Gson
|
||||
import kr.co.vividnext.sodalive.v2.common.CreatorActivityType
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelHomeResponse
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Test
|
||||
|
||||
class CreatorChannelHomeModelsTest {
|
||||
private val gson = Gson()
|
||||
|
||||
@Test
|
||||
fun `home response parses schedule type to creator activity type`() {
|
||||
val response = gson.fromJson(homeJson(scheduleType = "LIVE_REPLAY"), CreatorChannelHomeResponse::class.java)
|
||||
|
||||
assertEquals(CreatorActivityType.LiveReplay, response.schedules.single().type)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `home response preserves nullable fields`() {
|
||||
val response = gson.fromJson(homeJson(scheduleType = "AUDIO"), CreatorChannelHomeResponse::class.java)
|
||||
|
||||
assertNull(response.creator.characterId)
|
||||
assertNull(response.currentLive)
|
||||
assertNull(response.latestAudioContent)
|
||||
assertNull(response.fanTalk.latestFanTalk)
|
||||
assertNull(response.activity.debutDateUtc)
|
||||
}
|
||||
|
||||
private fun homeJson(scheduleType: String): String = """
|
||||
{
|
||||
"creator": {
|
||||
"creatorId": 1,
|
||||
"characterId": null,
|
||||
"nickname": "creator",
|
||||
"profileImageUrl": "https://example.com/profile.png",
|
||||
"followerCount": 10,
|
||||
"isAiChatAvailable": true,
|
||||
"isDmAvailable": true,
|
||||
"isFollow": false,
|
||||
"isNotify": false
|
||||
},
|
||||
"currentLive": null,
|
||||
"latestAudioContent": null,
|
||||
"channelDonations": [],
|
||||
"notices": [],
|
||||
"schedules": [
|
||||
{
|
||||
"scheduledAtUtc": "2026-06-12T00:00:00Z",
|
||||
"title": "schedule",
|
||||
"type": "$scheduleType",
|
||||
"targetId": 11
|
||||
}
|
||||
],
|
||||
"audioContents": [],
|
||||
"series": [],
|
||||
"communities": [],
|
||||
"fanTalk": {
|
||||
"totalCount": 0,
|
||||
"latestFanTalk": null
|
||||
},
|
||||
"introduce": "intro",
|
||||
"activity": {
|
||||
"debutDateUtc": null,
|
||||
"dDay": "D+1",
|
||||
"liveCount": 1,
|
||||
"liveDurationHours": 2,
|
||||
"liveContributorCount": 3,
|
||||
"audioContentCount": 4,
|
||||
"seriesCount": 5
|
||||
},
|
||||
"sns": {
|
||||
"instagramUrl": "",
|
||||
"fancimmUrl": "",
|
||||
"xUrl": "",
|
||||
"youtubeUrl": "",
|
||||
"kakaoOpenChatUrl": ""
|
||||
}
|
||||
}
|
||||
""".trimIndent()
|
||||
}
|
||||
Reference in New Issue
Block a user