fix(dm): MainV2Activity chat path 라우팅을 보정한다

This commit is contained in:
2026-06-19 05:03:32 +09:00
parent a87d2990b0
commit da64806d88
2 changed files with 45 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
package kr.co.vividnext.sodalive.v2.main
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
import java.io.File
@@ -7,15 +8,42 @@ import java.io.File
class MainV2ActivitySourceTest {
@Test
fun `MainV2Activity는 USER_CREATOR push room_id를 DM 채팅방으로 라우팅한다`() {
fun `MainV2Activity는 chat_type 없이 chat path만 DM 채팅방으로 라우팅한다`() {
val source = projectFile("app/src/main/java/kr/co/vividnext/sodalive/v2/main/MainV2Activity.kt").readText()
assertTrue(source.contains("import kr.co.vividnext.sodalive.v2.main.chat.dm.DmChatRoomActivity"))
assertTrue(source.contains("private fun isUserCreatorChat(bundle: Bundle): Boolean"))
assertTrue(source.contains("bundle.getString(\"chat_type\") == \"USER_CREATOR\""))
assertFalse(source.contains("chat_type"))
assertFalse(source.contains("isUserCreatorChat"))
assertTrue(source.contains("return bundle.getString(\"deep_link_value\") == \"chat\""))
assertTrue(source.contains("val roomId = bundle.getString(\"room_id\")?.toLongOrNull()"))
assertTrue(source.contains("DmChatRoomActivity.newIntentByRoomId(applicationContext, roomId)"))
assertTrue(source.contains("if (isUserCreatorChat(bundle) && roomId != null && roomId > 0)"))
assertTrue(source.contains("if (isDmChatDeepLink(bundle) && roomId != null && roomId > 0)"))
}
@Test
fun `MainV2Activity는 deep_link를 원본 bundle에 merge한다`() {
val source = projectFile("app/src/main/java/kr/co/vividnext/sodalive/v2/main/MainV2Activity.kt").readText()
assertTrue(source.contains("Bundle(bundle).apply"))
assertTrue(source.contains("buildBundleFromDeepLinkUrl(deepLinkUrl)?.let { putAll(it) }"))
assertTrue(source.contains("putQuery(\"room_id\")"))
}
@Test
fun `MainV2Activity는 chat path deep_link 단독 payload를 DM 채팅방으로 라우팅한다`() {
val source = projectFile("app/src/main/java/kr/co/vividnext/sodalive/v2/main/MainV2Activity.kt").readText()
val chatPathIndex = source.indexOf("\"chat\" ->")
val dmRouteIndex = source.indexOf("isDmChatDeepLink(bundle) && roomId != null && roomId > 0")
val firstFallbackIndex = source.indexOf("channelId != null && channelId > 0 ->")
assertTrue(chatPathIndex >= 0)
assertTrue(source.contains("putIfAbsent(\"room_id\", pathId)"))
assertTrue(source.contains("putIfAbsent(\"deep_link_value\", \"chat\")"))
assertTrue(source.contains("private fun isDmChatDeepLink(bundle: Bundle): Boolean"))
assertTrue(dmRouteIndex >= 0)
assertTrue(firstFallbackIndex >= 0)
assertTrue(dmRouteIndex < firstFallbackIndex)
}
private fun projectFile(relativePath: String): File {