feat(creator-community): 커뮤니티 댓글 알림 딥링크에 게시글 식별자를 포함한다

This commit is contained in:
2026-03-13 18:54:14 +09:00
parent 5b547cb73c
commit b13a9888d4
8 changed files with 252 additions and 9 deletions
@@ -127,6 +127,38 @@ class PushNotificationServiceTest {
assertEquals(1, saved.recipientChunks[2].recipientMemberIds.size)
}
@Test
fun shouldAppendPostIdQueryForCommunityCommentDeepLinkWhenSavingNotification() {
val event = FcmEvent(
type = FcmEventType.INDIVIDUAL,
category = PushNotificationCategory.COMMUNITY,
senderMemberId = 500L,
recipients = listOf(10L),
deepLinkValue = FcmDeepLinkValue.COMMUNITY,
deepLinkId = 77L,
deepLinkCommentPostId = 999L
)
val pushTokens = listOf(PushTokenInfo(token = "token-1", deviceType = "aos", languageCode = "ko"))
val sender = createMember(id = 500L, role = MemberRole.CREATOR, nickname = "creator")
Mockito.`when`(pushTokenRepository.findMemberIdsByTokenIn(listOf("token-1"))).thenReturn(listOf(10L))
Mockito.`when`(memberRepository.findById(500L)).thenReturn(Optional.of(sender))
Mockito.`when`(pushNotificationListRepository.save(Mockito.any(PushNotificationList::class.java)))
.thenAnswer { invocation -> invocation.getArgument(0) }
service.saveNotification(
fcmEvent = event,
languageCode = "ko",
translatedMessage = "새 댓글이 등록되었습니다.",
recipientPushTokens = pushTokens
)
val captor = ArgumentCaptor.forClass(PushNotificationList::class.java)
Mockito.verify(pushNotificationListRepository).save(captor.capture())
val saved = captor.value
assertEquals("voiceon://community/77?postId=999", saved.deepLink)
}
@Test
fun shouldApplyLanguageAndOptionalCategoryWhenGettingNotificationList() {
// given: 현재 기기 언어를 EN으로 설정하고 목록 조회 결과를 준비한다.