fix(content): 상세 오디오와 구매 흐름을 보정한다

This commit is contained in:
2026-07-12 08:32:48 +09:00
parent 53cc96b84d
commit 39959c3f47
5 changed files with 139 additions and 2 deletions
@@ -33,6 +33,7 @@ class CreatorChannelCommunityDetailReplyUiContractTest {
assertNotNull(detail.findViewById<RecyclerView>(R.id.rv_creator_channel_community_detail_comments))
assertNotNull(detail.findViewById<View>(R.id.layout_creator_channel_community_detail_paywall))
assertNotNull(detail.findViewById<TextView>(R.id.tv_creator_channel_community_detail_paywall_price))
assertNotNull(detail.findViewById<ImageView>(R.id.iv_creator_channel_community_detail_play_or_pause))
assertNotNull(detail.findViewById<View>(R.id.layout_creator_channel_community_detail_input_bar))
assertNotNull(detail.findViewById<EditText>(R.id.et_creator_channel_community_detail_comment))
assertNotNull(detail.findViewById<ImageButton>(R.id.btn_creator_channel_community_detail_send))
@@ -138,6 +139,23 @@ class CreatorChannelCommunityDetailReplyUiContractTest {
assertTrue(!replyActivity.contains("AlertDialog"))
}
@Test
fun `상세 Activity는 레거시 구매 다이얼로그와 이미지 중앙 오디오 버튼을 사용한다`() {
val detailLayout = projectFile("app/src/main/res/layout/activity_creator_channel_community_detail.xml").readText()
val detailActivity = projectFile(
"app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/community/detail/" +
"CreatorChannelCommunityDetailActivity.kt"
).readText()
assertTrue(detailLayout.contains("@+id/iv_creator_channel_community_detail_play_or_pause"))
assertTrue(detailLayout.contains("android:layout_gravity=\"center\""))
assertTrue(detailLayout.contains("@drawable/btn_audio_content_play"))
assertTrue(detailActivity.contains("PurchaseCommunityPostDialog"))
assertTrue(detailActivity.contains("viewModel.purchaseCommunityPost()"))
assertTrue(detailActivity.contains("btn_audio_content_pause"))
assertTrue(detailActivity.contains("btn_audio_content_play"))
}
@Test
fun `댓글 답글 Adapter는 PopupMenu 대신 regular font popup을 사용한다`() {
val commentAdapter = projectFile(
@@ -394,6 +394,51 @@ class CreatorChannelCommunityDetailViewModelTest {
assertFalse(state.post.showPaywall)
}
@Test
fun `게시물 구매 성공은 상세를 다시 조회해 잠금 상태를 해제한다`() {
whenever(repository.getCommunityPostDetail(POST_ID, AUTH_TOKEN))
.thenReturn(
Single.just(
ApiResponse(
true,
detailResponse(
isCommentAvailable = false,
price = 300,
existOrdered = false,
creatorId = 999L
),
null
)
),
Single.just(
ApiResponse(
true,
detailResponse(
isCommentAvailable = false,
price = 300,
existOrdered = true,
creatorId = 999L
),
null
)
)
)
whenever(legacyRepository.purchaseCommunityPost(POST_ID, AUTH_TOKEN))
.thenReturn(Single.just(ApiResponse(true, org.mockito.kotlin.mock(), null)))
viewModel.loadDetail(POST_ID)
viewModel.purchaseCommunityPost()
val state = viewModel.detailStateLiveData.requireValue() as CreatorChannelCommunityDetailUiState.Content
assertFalse(state.post.isLocked)
assertEquals("image.png", state.post.imageUrl)
assertEquals("audio.mp3", state.post.audioUrl)
assertTrue(state.post.existOrdered)
assertTrue(viewModel.postChangedEventLiveData.requireValue() == true)
verify(legacyRepository).purchaseCommunityPost(POST_ID, AUTH_TOKEN)
verify(repository, times(2)).getCommunityPostDetail(POST_ID, AUTH_TOKEN)
}
@Test
fun `댓글 UI 모델은 답글 화면 재포맷을 위해 원본 createdAtUtc를 보존한다`() {
stubDetail(detailResponse(isCommentAvailable = true, commentIds = listOf(11L)))