feat(mypage): 선물함 진입점을 추가한다

This commit is contained in:
2026-10-01 21:20:16 +09:00
parent e05861ff36
commit 73b332467f
4 changed files with 74 additions and 1 deletions
@@ -0,0 +1,47 @@
package kr.co.vividnext.sodalive.v2.gift
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
import java.io.File
class GiftInboxEntryPolicyTest {
@Test
fun `한국 접속이고 유효 언어가 한국어일 때만 표시한다`() {
assertTrue(GiftInboxEntryPolicy.shouldShow("KR", "ko"))
assertFalse(GiftInboxEntryPolicy.shouldShow("KR", "en"))
assertFalse(GiftInboxEntryPolicy.shouldShow("JP", "ko"))
assertFalse(GiftInboxEntryPolicy.shouldShow("JP", "ja"))
}
@Test
fun `빈 국가 코드는 기존 정책대로 한국으로 처리한다`() {
assertTrue(GiftInboxEntryPolicy.shouldShow("", "ko"))
assertFalse(GiftInboxEntryPolicy.shouldShow("", "en"))
}
@Test
fun `마이 탭은 조건부 선물함을 첫 번째 아이콘으로 연결한다`() {
val source = projectFile(
"app/src/main/java/kr/co/vividnext/sodalive/mypage/MyPageFragment.kt"
).readText()
val function = source
.substringAfter("private fun buildFunctionButtonItems")
.substringBefore("private fun showAuthDialog")
val presentIndex = function.indexOf("R.drawable.ic_my_present")
val storageIndex = function.indexOf("R.drawable.ic_my_storage")
assertTrue(presentIndex >= 0)
assertTrue(storageIndex >= 0)
assertTrue(presentIndex < storageIndex)
val giftBlock = function.substringBefore("R.drawable.ic_my_storage")
assertTrue(giftBlock.contains("GiftInboxEntryPolicy.shouldShow("))
assertTrue(giftBlock.contains("SharedPreferenceManager.countryCode"))
assertTrue(giftBlock.contains("LanguageManager.getEffectiveLanguage(requireContext())"))
assertTrue(giftBlock.contains("R.string.gift_inbox_title"))
assertTrue(giftBlock.contains("GiftInboxActivity.newIntent(requireContext())"))
}
private fun projectFile(path: String): File =
if (File("app").isDirectory) File(path) else File("../$path")
}