Skip to content

Commit

Permalink
refactor: 오늘의 리뷰 개수를 3개에서 2개로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
70825 committed Apr 23, 2024
1 parent 0824d5b commit 6a0feab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class ReviewService {
private static final int START_INDEX = 0;
private static final int ONE = 1;
private static final String EMPTY_URL = "";
private static final int RANKING_SIZE = 3;
private static final int RANKING_SIZE = 2;
private static final long RANKING_MINIMUM_FAVORITE_COUNT = 1L;
private static final int REVIEW_PAGE_SIZE = 10;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ class getRankingReviews_성공_테스트 {

// then
STATUS_CODE를_검증한다(응답, 정상_처리);
리뷰_랭킹_조회_결과를_검증한다(응답, List.of(리뷰2, 리뷰3, 리뷰4));
리뷰_랭킹_조회_결과를_검증한다(응답, List.of(리뷰2, 리뷰3));
}
}

Expand Down
20 changes: 8 additions & 12 deletions src/test/java/com/funeat/review/application/ReviewServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ class 리뷰_개수에_대한_테스트 {
}

@Test
void 전체_리뷰가_1개_이상_3개_미만이라도_리뷰가_나와야한다() {
void 전체_리뷰가_1개라도_리뷰가_나와야한다() {
// given
final var category = 카테고리_간편식사_생성();
단일_카테고리_저장(category);
Expand All @@ -1229,13 +1229,11 @@ class 리뷰_개수에_대한_테스트 {
단일_멤버_저장(member);

final var now = LocalDateTime.now();
final var review1 = 리뷰_이미지test5_평점5점_재구매X_생성(member, product, 2L, now.minusDays(1L));
final var review2 = 리뷰_이미지test5_평점5점_재구매X_생성(member, product, 2L, now);
복수_리뷰_저장(review1, review2);
final var review = 리뷰_이미지test5_평점5점_재구매X_생성(member, product, 2L, now.minusDays(1L));
단일_리뷰_저장(review);

final var rankingReviewDto1 = RankingReviewDto.toDto(review1);
final var rankingReviewDto2 = RankingReviewDto.toDto(review2);
final var rankingReviewDtos = List.of(rankingReviewDto2, rankingReviewDto1);
final var rankingReviewDto = RankingReviewDto.toDto(review);
final var rankingReviewDtos = List.of(rankingReviewDto);
final var expected = RankingReviewsResponse.toResponse(rankingReviewDtos);

// when
Expand All @@ -1247,7 +1245,7 @@ class 리뷰_개수에_대한_테스트 {
}

@Test
void 전체_리뷰_중_랭킹이_높은_상위_3개_리뷰를_구할_수_있다() {
void 전체_리뷰_중_랭킹이_높은_상위_2개_리뷰를_구할_수_있다() {
// given
final var category = 카테고리_간편식사_생성();
단일_카테고리_저장(category);
Expand All @@ -1262,14 +1260,12 @@ class 리뷰_개수에_대한_테스트 {
final var review1 = 리뷰_이미지test5_평점5점_재구매X_생성(member, product, 4L, now.minusDays(3L));
final var review2 = 리뷰_이미지test5_평점5점_재구매X_생성(member, product, 6L, now.minusDays(2L));
final var review3 = 리뷰_이미지test5_평점5점_재구매X_생성(member, product, 4L, now);
final var review4 = 리뷰_이미지test5_평점5점_재구매X_생성(member, product, 5L, now);
복수_리뷰_저장(review1, review2, review3, review4);
복수_리뷰_저장(review1, review2, review3);

final var rankingReviewDto1 = RankingReviewDto.toDto(review1);
final var rankingReviewDto2 = RankingReviewDto.toDto(review2);
final var rankingReviewDto3 = RankingReviewDto.toDto(review3);
final var rankingReviewDto4 = RankingReviewDto.toDto(review4);
final var rankingReviewDtos = List.of(rankingReviewDto4, rankingReviewDto3, rankingReviewDto2);
final var rankingReviewDtos = List.of(rankingReviewDto3, rankingReviewDto2);
final var expected = RankingReviewsResponse.toResponse(rankingReviewDtos);

// when
Expand Down

0 comments on commit 6a0feab

Please sign in to comment.