test #426

Merged
klaus merged 415 commits from test into main 2026-06-27 00:35:30 +00:00
2 changed files with 27 additions and 4 deletions
Showing only changes of commit 6ab8d65207 - Show all commits

View File

@@ -68,7 +68,7 @@ class AudioRecommendationSnapshotRefreshService(
visibility: AudioRecommendationVisibility
) {
val sectionType = visibility.newAndHotSectionType()
val snapshots = queryPort.findNewAndHotSnapshots(windowStart, snapshotAt, visibility, NEW_AND_HOT_LIMIT)
val snapshots = queryPort.findNewAndHotSnapshots(windowStart, snapshotAt, visibility, NEW_AND_HOT_SNAPSHOT_LIMIT)
snapshotPort.replaceSnapshots(sectionType, snapshotAt, snapshots)
}
@@ -128,7 +128,7 @@ class AudioRecommendationSnapshotRefreshService(
}
companion object {
const val NEW_AND_HOT_LIMIT = 12
const val NEW_AND_HOT_SNAPSHOT_LIMIT = 100
const val MOST_COMMENTED_LIMIT = 5
const val RECOMMENDED_AUDIO_LIMIT = 10
private val KST_ZONE: ZoneId = ZoneId.of("Asia/Seoul")

View File

@@ -30,7 +30,7 @@ class AudioRecommendationSnapshotRefreshServiceTest {
newAndHotWindowStart,
snapshotAt,
AudioRecommendationVisibility.SAFE,
AudioRecommendationSnapshotRefreshService.NEW_AND_HOT_LIMIT
AudioRecommendationSnapshotRefreshService.NEW_AND_HOT_SNAPSHOT_LIMIT
)
Mockito.verify(queryPort).findMostCommentedSnapshots(
mostCommentedWindowStart,
@@ -66,7 +66,7 @@ class AudioRecommendationSnapshotRefreshServiceTest {
newAndHotWindowStart,
snapshotAt,
AudioRecommendationVisibility.SAFE,
AudioRecommendationSnapshotRefreshService.NEW_AND_HOT_LIMIT
AudioRecommendationSnapshotRefreshService.NEW_AND_HOT_SNAPSHOT_LIMIT
)
Mockito.verify(queryPort).findMostCommentedSnapshots(
mostCommentedWindowStart,
@@ -81,4 +81,27 @@ class AudioRecommendationSnapshotRefreshServiceTest {
AudioRecommendationSnapshotRefreshService.RECOMMENDED_AUDIO_LIMIT
)
}
@Test
@DisplayName("New & Hot 스냅샷은 visibility별 100개 후보를 저장한다")
fun shouldRequestOneHundredNewAndHotSnapshotsPerVisibility() {
val now = LocalDateTime.of(2026, 6, 27, 0, 0, 0)
val snapshotAt = LocalDateTime.of(2026, 6, 26, 23, 59, 59)
val windowStart = LocalDateTime.of(2026, 6, 24, 0, 0, 0)
service.refreshDailySnapshots(now)
Mockito.verify(queryPort).findNewAndHotSnapshots(
windowStart,
snapshotAt,
AudioRecommendationVisibility.SAFE,
100
)
Mockito.verify(queryPort).findNewAndHotSnapshots(
windowStart,
snapshotAt,
AudioRecommendationVisibility.ALL,
100
)
}
}