feat(creator-channel): FanTalk 답글 API 응답을 연결한다

This commit is contained in:
2026-07-09 07:43:47 +09:00
parent f9160ccb02
commit 643fb9fa8e
5 changed files with 38 additions and 7 deletions

View File

@@ -16,6 +16,7 @@ import kr.co.vividnext.sodalive.common.ApiResponse
import kr.co.vividnext.sodalive.common.AndroidUtcRelativeTimeTextFormatter
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelRepository
import kr.co.vividnext.sodalive.v2.creator.channel.fantalk.data.CreatorChannelFanTalkReplyResponse
import kr.co.vividnext.sodalive.v2.creator.channel.fantalk.data.CreatorChannelFanTalkResponse
import kr.co.vividnext.sodalive.v2.creator.channel.fantalk.data.CreatorChannelFanTalkTabResponse
import org.junit.After
@@ -104,7 +105,7 @@ class CreatorChannelFanTalkActionTest {
Single.just(ApiResponse(true, fanTalkResponse(ids = listOf(2L)), null))
)
whenever(repository.deleteFanTalk(1L, "Bearer test-token"))
.thenReturn(Single.just(ApiResponse(true, Any(), "deleted")))
.thenReturn(Single.just(ApiResponse<CreatorChannelFanTalkReplyResponse>(true, null, "deleted")))
viewModel.loadFanTalks(100L, isOwner = false)
viewModel.deleteFanTalk(1L)

View File

@@ -13,6 +13,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers
import kr.co.vividnext.sodalive.common.ApiResponse
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelRepository
import kr.co.vividnext.sodalive.v2.creator.channel.fantalk.data.CreatorChannelFanTalkReplyResponse
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
@@ -106,7 +107,7 @@ class CreatorChannelFanTalkWriteViewModelTest {
@Test
fun `활성 상태에서 submit하면 trim content와 토큰으로 FanTalk 등록 API를 호출한다`() {
whenever(repository.writeFanTalk(100L, "응원합니다", "Bearer test-token"))
.thenReturn(Single.just(ApiResponse<Any>(true, null, null)))
.thenReturn(Single.just(ApiResponse<CreatorChannelFanTalkReplyResponse>(true, null, null)))
viewModel.onContentChanged(" 응원합니다 ")
viewModel.submit(creatorId = 100L)
@@ -132,7 +133,7 @@ class CreatorChannelFanTalkWriteViewModelTest {
@Test
fun `등록 실패 시 입력값을 유지하고 서버 message를 우선 toast로 emit한다`() {
whenever(repository.writeFanTalk(100L, "응원합니다", "Bearer test-token"))
.thenReturn(Single.just(ApiResponse<Any>(false, null, "서버 실패")))
.thenReturn(Single.just(ApiResponse<CreatorChannelFanTalkReplyResponse>(false, null, "서버 실패")))
viewModel.onContentChanged(" 응원합니다 ")
viewModel.submit(creatorId = 100L)