refactor(main): 메인 접근 가드를 공통화한다
This commit is contained in:
@@ -18,6 +18,13 @@ class MainV2ActivitySourceTest {
|
||||
assertTrue(source.contains("val roomId = bundle.getString(\"room_id\")?.toLongOrNull()"))
|
||||
assertTrue(source.contains("DmChatRoomActivity.newIntentByRoomId(applicationContext, roomId)"))
|
||||
assertTrue(source.contains("if (isDmChatDeepLink(bundle) && roomId != null && roomId > 0)"))
|
||||
assertFalse(source.contains("private fun isLoggedIn()"))
|
||||
assertTrue(source.contains("fun showLoginActivity()"))
|
||||
assertBefore(
|
||||
source.substringFrom("fun showLoginActivity()"),
|
||||
"ensureV2Access(AccessRequirement.Login)",
|
||||
"fun openContentAllTab"
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -53,9 +60,10 @@ class MainV2ActivitySourceTest {
|
||||
assertTrue(source.contains("private fun selectChatTabWithLoginGuard(): Boolean"))
|
||||
|
||||
val guardSource = source.substringFrom("private fun selectChatTabWithLoginGuard(): Boolean")
|
||||
assertBefore(guardSource, "if (!isLoggedIn())", "viewModel.clickTab(MainV2Tab.CHAT)")
|
||||
assertBefore(guardSource, "showLoginActivity()", "return false")
|
||||
assertTrue(guardSource.contains("return true"))
|
||||
assertTrue(guardSource.contains("return ensureV2Access(AccessRequirement.Login)"))
|
||||
assertBefore(guardSource, "ensureV2Access(AccessRequirement.Login)", "viewModel.clickTab(MainV2Tab.CHAT)")
|
||||
assertFalse(guardSource.contains("isLoggedIn()"))
|
||||
assertFalse(guardSource.contains("showLoginActivity()"))
|
||||
|
||||
val setupViewSource = source.substringFrom("override fun setupView()")
|
||||
assertTrue(setupViewSource.contains("selectChatTabWithLoginGuard()"))
|
||||
|
||||
+2
-2
@@ -26,11 +26,11 @@ class MainV2AudioNotificationRouteSourceTest {
|
||||
fun `오디오 알림 route는 채팅 필터 이후 딥링크 이전에 처리된다`() {
|
||||
val onNewIntentSource = source.substringFrom("override fun onNewIntent(intent: Intent)")
|
||||
assertBefore(onNewIntentSource, "if (intent.hasExtra(EXTRA_CHAT_FILTER))", "handleAudioNotificationRoute(intent)")
|
||||
assertBefore(onNewIntentSource, "handleAudioNotificationRoute(intent)", "isLoggedIn()")
|
||||
assertBefore(onNewIntentSource, "handleAudioNotificationRoute(intent)", "isV2AccessAllowed(AccessRequirement.Login)")
|
||||
assertBefore(onNewIntentSource, "handleAudioNotificationRoute(intent)", "executeDeeplink(intent)")
|
||||
|
||||
val onCreateSource = source.substringFrom("override fun onCreate(savedInstanceState: Bundle?)")
|
||||
assertBefore(onCreateSource, "handleAudioNotificationRoute(intent)", "isLoggedIn()")
|
||||
assertBefore(onCreateSource, "handleAudioNotificationRoute(intent)", "isV2AccessAllowed(AccessRequirement.Login)")
|
||||
assertBefore(onCreateSource, "handleAudioNotificationRoute(intent)", "executeDeeplink(intent)")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user