feat(home): 인기 커뮤니티 빈 스냅샷 marker를 저장한다
This commit is contained in:
@@ -84,7 +84,9 @@ class RecommendationSnapshotPersistenceAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun supportsEmptySnapshotMarker(sectionType: RecommendedSectionType): Boolean {
|
private fun supportsEmptySnapshotMarker(sectionType: RecommendedSectionType): Boolean {
|
||||||
return sectionType == RecommendedSectionType.AI_CHARACTER || sectionType == RecommendedSectionType.CHEER_CREATOR
|
return sectionType == RecommendedSectionType.AI_CHARACTER ||
|
||||||
|
sectionType == RecommendedSectionType.CHEER_CREATOR ||
|
||||||
|
sectionType == RecommendedSectionType.POPULAR_COMMUNITY
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
@@ -217,6 +217,25 @@ class RecommendationSnapshotPersistenceAdapterTest @Autowired constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun shouldSavePopularCommunityEmptySnapshotMarkerWhenReplacingWithEmptySnapshots() {
|
||||||
|
val snapshotAt = LocalDateTime.of(2026, 5, 29, 23, 59, 59)
|
||||||
|
|
||||||
|
adapter.replaceSnapshots(RecommendedSectionType.POPULAR_COMMUNITY, snapshotAt, emptyList())
|
||||||
|
|
||||||
|
assertEquals(
|
||||||
|
emptyList<RecommendationSnapshotRecord>(),
|
||||||
|
adapter.findSnapshots(RecommendedSectionType.POPULAR_COMMUNITY, snapshotAt)
|
||||||
|
)
|
||||||
|
assertEquals(true, adapter.existsSnapshot(RecommendedSectionType.POPULAR_COMMUNITY, snapshotAt))
|
||||||
|
assertEquals(
|
||||||
|
listOf(0L),
|
||||||
|
repository.findAll()
|
||||||
|
.filter { it.sectionType == RecommendedSectionType.POPULAR_COMMUNITY }
|
||||||
|
.map { it.targetId }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun shouldReplaceCheerCreatorEmptyMarkerWithRealSnapshots() {
|
fun shouldReplaceCheerCreatorEmptyMarkerWithRealSnapshots() {
|
||||||
val snapshotAt = LocalDateTime.of(2026, 5, 29, 23, 59, 59)
|
val snapshotAt = LocalDateTime.of(2026, 5, 29, 23, 59, 59)
|
||||||
@@ -245,6 +264,34 @@ class RecommendationSnapshotPersistenceAdapterTest @Autowired constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun shouldReplacePopularCommunityEmptyMarkerWithRealSnapshots() {
|
||||||
|
val snapshotAt = LocalDateTime.of(2026, 5, 29, 23, 59, 59)
|
||||||
|
adapter.replaceSnapshots(RecommendedSectionType.POPULAR_COMMUNITY, snapshotAt, emptyList())
|
||||||
|
|
||||||
|
adapter.replaceSnapshots(
|
||||||
|
RecommendedSectionType.POPULAR_COMMUNITY,
|
||||||
|
snapshotAt,
|
||||||
|
listOf(
|
||||||
|
RecommendationSnapshotRecord(
|
||||||
|
sectionType = RecommendedSectionType.POPULAR_COMMUNITY,
|
||||||
|
targetId = 19L,
|
||||||
|
score = 190.0,
|
||||||
|
snapshotAt = snapshotAt,
|
||||||
|
randomTieBreaker = 0.9
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
assertEquals(listOf(19L), adapter.findSnapshots(RecommendedSectionType.POPULAR_COMMUNITY, snapshotAt).map { it.targetId })
|
||||||
|
assertEquals(
|
||||||
|
listOf(19L),
|
||||||
|
repository.findAll()
|
||||||
|
.filter { it.sectionType == RecommendedSectionType.POPULAR_COMMUNITY }
|
||||||
|
.map { it.targetId }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private fun snapshot(
|
private fun snapshot(
|
||||||
sectionType: RecommendedSectionType,
|
sectionType: RecommendedSectionType,
|
||||||
targetId: Long,
|
targetId: Long,
|
||||||
|
|||||||
Reference in New Issue
Block a user