fix(live-room): 종료 경합의 중복 재조회와 오류 토스트를 막는다
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package kr.co.vividnext.sodalive.live.room
|
||||
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class LiveRoomOfflineActionPolicyTest {
|
||||
|
||||
@Test
|
||||
fun `방장 offline이 처음 감지되면 종료만 수행한다`() {
|
||||
val action = resolveLiveRoomOfflineAction(
|
||||
isHostOffline = true,
|
||||
hasKnownHostAbsence = false
|
||||
)
|
||||
|
||||
assertTrue(action.shouldMarkHostAbsence)
|
||||
assertTrue(action.shouldFinishRoom)
|
||||
assertFalse(action.shouldRefreshRoomInfo)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `방장이 아직 남아있으면 비방장 offline에서 방 정보를 재조회한다`() {
|
||||
val action = resolveLiveRoomOfflineAction(
|
||||
isHostOffline = false,
|
||||
hasKnownHostAbsence = false
|
||||
)
|
||||
|
||||
assertFalse(action.shouldMarkHostAbsence)
|
||||
assertFalse(action.shouldFinishRoom)
|
||||
assertTrue(action.shouldRefreshRoomInfo)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `방장 부재가 이미 확정되면 후속 offline에서는 아무 동작도 하지 않는다`() {
|
||||
val action = resolveLiveRoomOfflineAction(
|
||||
isHostOffline = false,
|
||||
hasKnownHostAbsence = true
|
||||
)
|
||||
|
||||
assertFalse(action.shouldMarkHostAbsence)
|
||||
assertFalse(action.shouldFinishRoom)
|
||||
assertFalse(action.shouldRefreshRoomInfo)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package kr.co.vividnext.sodalive.live.room
|
||||
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class LiveRoomRoomInfoErrorPolicyTest {
|
||||
|
||||
@Test
|
||||
fun `leave 재조회에서 라이브 정보가 없습니다 메시지는 숨긴다`() {
|
||||
assertTrue(
|
||||
shouldSuppressLiveRoomInfoError(
|
||||
message = "라이브 정보가 없습니다.",
|
||||
suppressRoomNotFoundError = true
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `suppress 플래그가 없으면 같은 메시지도 숨기지 않는다`() {
|
||||
assertFalse(
|
||||
shouldSuppressLiveRoomInfoError(
|
||||
message = "라이브 정보가 없습니다.",
|
||||
suppressRoomNotFoundError = false
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `관련 없는 오류 메시지는 그대로 노출한다`() {
|
||||
assertFalse(
|
||||
shouldSuppressLiveRoomInfoError(
|
||||
message = "네트워크 오류가 발생했습니다.",
|
||||
suppressRoomNotFoundError = true
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user