Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] fix: 축제 상세 조회 시 공연 목록 시작 시간으로 정렬되도록 수정 (#967) #968

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public Optional<FestivalDetailV1Response> findFestivalDetail(Long festivalId) {
stage.id,
stage.startTime,
stageQueryInfo.artistInfo
).skipNulls(), Comparator.comparingLong(StageV1Response::id))
).skipNulls(), Comparator.comparing(StageV1Response::startDateTime))
)
)
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.festago.festival.application.integration.query;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.SoftAssertions.assertSoftly;

Expand All @@ -10,6 +11,7 @@
import com.festago.festival.application.FestivalDetailV1QueryService;
import com.festago.festival.domain.Festival;
import com.festago.festival.dto.SocialMediaV1Response;
import com.festago.festival.dto.StageV1Response;
import com.festago.festival.repository.FestivalRepository;
import com.festago.school.domain.School;
import com.festago.school.repository.SchoolRepository;
Expand All @@ -28,6 +30,7 @@
import com.festago.support.fixture.StageArtistFixture;
import com.festago.support.fixture.StageFixture;
import java.time.LocalDate;
import java.time.LocalDateTime;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayNameGeneration;
import org.junit.jupiter.api.DisplayNameGenerator;
Expand Down Expand Up @@ -174,6 +177,18 @@ private School createSchool(String schoolName, String domain) {
});
}

@Test
void 공연_목록은_공연의_시작_시간_기준으로_정렬된다() {
// when
var response = festivalDetailV1QueryService.findFestivalDetail(테코대학교_축제.getId());

// then
assertThat(response.stages())
.map(StageV1Response::startDateTime)
.map(LocalDateTime::toLocalDate)
.containsExactly(now, now.plusDays(1), now.plusDays(2));
}

@Test
void 축제에_공연이_없으면_응답의_공연에는_비어있는_컬렉션이_반환된다() {
// when
Expand Down
Loading