test(live): 온에어 입장 가능 정책을 검증한다

This commit is contained in:
2026-06-27 01:10:02 +09:00
parent 2ad59dfd96
commit 541771d72c
2 changed files with 65 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
package kr.co.vividnext.sodalive.v2.live.onair.model
import kr.co.vividnext.sodalive.live.room.detail.GetRoomDetailResponse
fun canEnterHomeOnAirLiveRoom(roomDetail: GetRoomDetailResponse): Boolean {
return roomDetail.channelName.isNullOrBlank().not()
}

View File

@@ -0,0 +1,58 @@
package kr.co.vividnext.sodalive.v2.live.onair
import kr.co.vividnext.sodalive.live.room.GenderRestriction
import kr.co.vividnext.sodalive.live.room.detail.GetRoomDetailManager
import kr.co.vividnext.sodalive.live.room.detail.GetRoomDetailResponse
import kr.co.vividnext.sodalive.v2.live.onair.model.canEnterHomeOnAirLiveRoom
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
class HomeOnAirLiveEntryPolicyTest {
@Test
fun `channelName이 있으면 입장 분기를 허용한다`() {
assertTrue(canEnterHomeOnAirLiveRoom(roomDetail(channelName = "channel-a")))
}
@Test
fun `channelName이 null이면 입장 분기를 중단한다`() {
assertFalse(canEnterHomeOnAirLiveRoom(roomDetail(channelName = null)))
}
@Test
fun `channelName이 blank이면 입장 분기를 중단한다`() {
assertFalse(canEnterHomeOnAirLiveRoom(roomDetail(channelName = " ")))
}
private fun roomDetail(channelName: String?) = GetRoomDetailResponse(
roomId = 1L,
price = 0,
title = "title",
notice = "notice",
isPaid = false,
isAdult = false,
genderRestriction = GenderRestriction.ALL,
isPrivateRoom = false,
password = null,
tags = emptyList(),
channelName = channelName,
beginDateTimeUtc = "2026-06-26T12:00:00",
isNotification = false,
numberOfParticipants = 1,
numberOfParticipantsTotal = 10,
manager = GetRoomDetailManager(
id = 100L,
nickname = "creator",
introduce = "",
youtubeUrl = null,
instagramUrl = null,
kakaoOpenChatUrl = null,
fancimmUrl = null,
xUrl = null,
profileImageUrl = "",
isCreator = true
),
participatingUsers = emptyList()
)
}