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] 페이지 조회 시 중복되는 아이템 조회되는 이슈 피드백 반영완료 #332

Merged
merged 1 commit into from
Aug 2, 2022
Merged
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 @@ -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