Skip to content

Commit

Permalink
[BE] 페이지 조회 시 중복되는 아이템 조회되는 이슈 피드백 반영완료 (#332)
Browse files Browse the repository at this point in the history
test: 제품을 조회할 때, 정렬 조건으로 id에 대한 역순을 적용하더라도, 정렬이 되는지 확인하는 test 추가

Co-authored-by: hamcheeseburger <[email protected]>
Co-authored-by: yangdongjue5510 <[email protected]>

Co-authored-by: hamcheeseburger <[email protected]>
Co-authored-by: yangdongjue5510 <[email protected]>
  • Loading branch information
3 people authored Aug 2, 2022
1 parent 591a762 commit 6a6f273
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class ProductAcceptanceTest extends AcceptanceTest {
}

@Test
void 리뷰_갯수가_같은_상태에서_제품_목록을_리뷰가_많은_순서로_페이징하여_조회하면_id_역순으로_조회된다() {
void 리뷰_개수가_같은_상태에서_제품_목록을_리뷰가_많은_순서로_페이징하여_조회하면_id_역순으로_조회된다() {
// given
Product product1 = 제품을_저장한다(KEYBOARD_1.생성());
Product product2 = 제품을_저장한다(KEYBOARD_2.생성());
Expand All @@ -149,6 +149,27 @@ class ProductAcceptanceTest extends AcceptanceTest {
);
}

@Test
void 정렬_조건으로_id_역순으로_페이징하여_조회하면_id_역순으로_조회된다() {
// given
Product product1 = 제품을_저장한다(KEYBOARD_1.생성());
Product product2 = 제품을_저장한다(KEYBOARD_2.생성());
Product product3 = 제품을_저장한다(MOUSE_1.생성());

// when
ExtractableResponse<Response> response = GET_요청을_보낸다(
"/api/v1/products?page=0&size=3&sort=id,desc");

// then
assertAll(
() -> assertThat(response.statusCode()).isEqualTo(HttpStatus.OK.value()),
() -> assertThat(response.as(ProductPageResponse.class).getItems())
.extracting("id")
.containsExactly(product3.getId(), product2.getId(), product1.getId()),
() -> assertThat(response.as(ProductPageResponse.class).isHasNext()).isFalse()
);
}

@Test
void 키보드_목록을_평점_높은_순서로_페이징하여_조회한다() {
// given
Expand Down

0 comments on commit 6a6f273

Please sign in to comment.