feat(home): 최근 활동 이동 식별자를 보강한다
This commit is contained in:
+25
-1
@@ -524,6 +524,28 @@ class HomeRecommendationControllerTest @Autowired constructor(
|
||||
.andExpect(jsonPath("$.data.items[0].creatorId").value(character.creatorMember!!.id))
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("최근 활동 라이브 크리에이터는 creatorId와 라이브 상태별 targetId를 노출한다")
|
||||
fun shouldExposeNavigationIdsForRecentlyActiveLiveCreators() {
|
||||
val activeCreator = saveMember("active-live-activity", MemberRole.CREATOR)
|
||||
val inactiveCreator = saveMember("inactive-live-activity", MemberRole.CREATOR)
|
||||
val baseAt = LocalDateTime.of(2026, 5, 31, 10, 0)
|
||||
val activeLive = saveLiveRoom(activeCreator, baseAt.plusMinutes(2), "active-live-channel", isAdult = false)
|
||||
saveLiveRoom(inactiveCreator, baseAt.plusMinutes(1), "inactive-live-channel", isAdult = false, isActive = false)
|
||||
entityManager.flush()
|
||||
entityManager.clear()
|
||||
|
||||
mockMvc.perform(get("/api/v2/home/recommendations"))
|
||||
.andExpect(status().isOk)
|
||||
.andExpect(jsonPath("$.data.recentlyActiveCreators[0].creatorId").value(activeCreator.id))
|
||||
.andExpect(jsonPath("$.data.recentlyActiveCreators[0].activityType").value("LIVE"))
|
||||
.andExpect(jsonPath("$.data.recentlyActiveCreators[0].targetId").value(activeLive.id))
|
||||
.andExpect(jsonPath("$.data.recentlyActiveCreators[1].creatorId").value(inactiveCreator.id))
|
||||
.andExpect(jsonPath("$.data.recentlyActiveCreators[1].activityType").value("LIVE"))
|
||||
.andExpect(jsonPath("$.data.recentlyActiveCreators[1].targetId").hasJsonPath())
|
||||
.andExpect(jsonPath("$.data.recentlyActiveCreators[1].targetId").doesNotExist())
|
||||
}
|
||||
|
||||
private fun saveMember(seed: String, role: MemberRole): Member {
|
||||
return memberRepository.saveAndFlush(
|
||||
Member(
|
||||
@@ -548,7 +570,8 @@ class HomeRecommendationControllerTest @Autowired constructor(
|
||||
creator: Member,
|
||||
beginDateTime: LocalDateTime,
|
||||
channelName: String,
|
||||
isAdult: Boolean
|
||||
isAdult: Boolean,
|
||||
isActive: Boolean = true
|
||||
): LiveRoom {
|
||||
val room = LiveRoom(
|
||||
title = "live-${creator.nickname}-$channelName",
|
||||
@@ -559,6 +582,7 @@ class HomeRecommendationControllerTest @Autowired constructor(
|
||||
)
|
||||
room.member = creator
|
||||
room.channelName = channelName
|
||||
room.isActive = isActive
|
||||
entityManager.persist(room)
|
||||
return room
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user