feat(home-following): 최근 소식 source key를 추가한다
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package kr.co.vividnext.sodalive.v2.home.following.domain
|
||||
|
||||
import java.time.LocalDateTime
|
||||
|
||||
object HomeFollowingNewsSourceKey {
|
||||
fun creatorRanking(creatorId: Long, aggregationStartAtUtc: LocalDateTime): String {
|
||||
return "${FollowingNewsType.CREATOR_RANKING.name}:$creatorId:$aggregationStartAtUtc"
|
||||
}
|
||||
|
||||
fun audioContent(contentId: Long): String {
|
||||
return "${FollowingNewsType.AUDIO_CONTENT.name}:$contentId"
|
||||
}
|
||||
|
||||
fun communityPost(postId: Long): String {
|
||||
return "${FollowingNewsType.COMMUNITY_POST.name}:$postId"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package kr.co.vividnext.sodalive.v2.home.following.domain
|
||||
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.DisplayName
|
||||
import org.junit.jupiter.api.Test
|
||||
import java.time.LocalDateTime
|
||||
|
||||
class HomeFollowingNewsSourceKeyTest {
|
||||
@Test
|
||||
@DisplayName("크리에이터 랭킹 source key는 타입, 크리에이터, 집계 시작 시각으로 생성한다")
|
||||
fun shouldCreateCreatorRankingSourceKey() {
|
||||
val aggregationStartAtUtc = LocalDateTime.of(2026, 5, 31, 15, 0)
|
||||
|
||||
val sourceKey = HomeFollowingNewsSourceKey.creatorRanking(
|
||||
creatorId = 10L,
|
||||
aggregationStartAtUtc = aggregationStartAtUtc
|
||||
)
|
||||
|
||||
assertEquals("CREATOR_RANKING:10:2026-05-31T15:00", sourceKey)
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("오디오 콘텐츠 source key는 타입과 콘텐츠 id로 생성한다")
|
||||
fun shouldCreateAudioContentSourceKey() {
|
||||
assertEquals("AUDIO_CONTENT:300", HomeFollowingNewsSourceKey.audioContent(contentId = 300L))
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("커뮤니티 게시글 source key는 타입과 게시글 id로 생성한다")
|
||||
fun shouldCreateCommunityPostSourceKey() {
|
||||
assertEquals("COMMUNITY_POST:400", HomeFollowingNewsSourceKey.communityPost(postId = 400L))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user