refactor(v2): 도메인 액션 경로를 통합한다
This commit is contained in:
@@ -8,14 +8,16 @@ import java.io.File
|
||||
class DeepLinkActivitySourceTest {
|
||||
|
||||
@Test
|
||||
fun `DeepLinkActivity는 chat_type 없이 chat path만 DM 채팅방으로 라우팅한다`() {
|
||||
fun `DeepLinkActivity는 chat path DM을 Chat Action으로 라우팅한다`() {
|
||||
val source = projectFile("app/src/main/java/kr/co/vividnext/sodalive/main/DeepLinkActivity.kt").readText()
|
||||
|
||||
assertTrue(source.contains("import kr.co.vividnext.sodalive.v2.main.chat.dm.DmChatRoomActivity"))
|
||||
assertTrue(source.contains("import kr.co.vividnext.sodalive.v2.chat.action.ChatActionCommand"))
|
||||
assertTrue(source.contains("import kr.co.vividnext.sodalive.v2.chat.action.handleChatAction"))
|
||||
assertFalse(source.contains("chat_type"))
|
||||
assertFalse(source.contains("isUserCreatorChat"))
|
||||
assertTrue(source.contains("return bundle.getString(\"deep_link_value\") == \"chat\""))
|
||||
assertTrue(source.contains("DmChatRoomActivity.newIntentByRoomId(applicationContext, roomId)"))
|
||||
assertTrue(source.contains("handleChatAction(ChatActionCommand.DmRoom(roomId))"))
|
||||
assertFalse(source.contains("DmChatRoomActivity.newIntentByRoomId(applicationContext, roomId)"))
|
||||
assertTrue(source.contains("if (isDmChatDeepLink(bundle) && roomId != null && roomId > 0)"))
|
||||
}
|
||||
|
||||
@@ -50,6 +52,47 @@ class DeepLinkActivitySourceTest {
|
||||
assertTrue(dmRouteIndex < liveRouteIndex)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `DeepLinkActivity는 Community post를 creator fallback보다 먼저 Action으로 라우팅한다`() {
|
||||
val source = projectFile("app/src/main/java/kr/co/vividnext/sodalive/main/DeepLinkActivity.kt").readText()
|
||||
|
||||
val postRouteIndex = source.indexOf("communityPostId != null && communityPostId > 0 ->")
|
||||
val creatorFallbackIndex = source.indexOf("communityCreatorId != null && communityCreatorId > 0 ->")
|
||||
|
||||
assertTrue(postRouteIndex >= 0)
|
||||
assertTrue(creatorFallbackIndex >= 0)
|
||||
assertTrue(postRouteIndex < creatorFallbackIndex)
|
||||
assertTrue(
|
||||
source.contains(
|
||||
"handleCommunityAction(CommunityActionCommand.PostDetail(communityPostId))"
|
||||
)
|
||||
)
|
||||
assertTrue(
|
||||
source.contains(
|
||||
"handleCreatorAction(CreatorActionCommand.Profile(communityCreatorId))"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `DeepLinkActivity는 foreground 도메인 상세를 기존 Action으로 실행한다`() {
|
||||
val source = projectFile("app/src/main/java/kr/co/vividnext/sodalive/main/DeepLinkActivity.kt").readText()
|
||||
val routeSource = source.substringAfter("private fun routeByDeepLinkValue(")
|
||||
.substringBefore("private fun applyPathDeepLink(")
|
||||
val communityRoute = routeSource.substringAfter("\"community\" ->").substringBefore("\"message\" ->")
|
||||
val messageRoute = routeSource.substringAfter("\"message\" ->").substringBefore("\"audition\" ->")
|
||||
|
||||
assertTrue(source.contains("handleContentAction(ContentActionCommand.AudioDetail(contentId))"))
|
||||
assertTrue(source.contains("handleContentAction(ContentActionCommand.SeriesDetail(deepLinkValueId))"))
|
||||
assertTrue(source.contains("handleCreatorAction(CreatorActionCommand.Profile(channelId))"))
|
||||
assertTrue(source.contains("handleChatAction(ChatActionCommand.DmRoom(roomId))"))
|
||||
assertTrue(source.contains("routeLiveInMain(roomId)"))
|
||||
assertTrue(communityRoute.contains("handleCreatorAction(CreatorActionCommand.Profile(deepLinkValueId))"))
|
||||
assertFalse(communityRoute.contains("CommunityActionCommand.PostDetail"))
|
||||
assertTrue(messageRoute.contains("MessageActivity::class.java"))
|
||||
assertFalse(messageRoute.contains("ChatActionCommand.DmRoom"))
|
||||
}
|
||||
|
||||
private fun projectFile(relativePath: String): File {
|
||||
val candidates = listOf(File(relativePath), File("../$relativePath"))
|
||||
return candidates.firstOrNull { it.exists() }
|
||||
|
||||
Reference in New Issue
Block a user