Skip to content

Commit

Permalink
[WHD-293] Fix: inquiry test
Browse files Browse the repository at this point in the history
  • Loading branch information
juy4844 committed Dec 5, 2024
1 parent f5aa3a3 commit 474c3ec
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ public ClubPaymentResponse getClubPaymentByTerm(@RequestParam(required = false)

@GetMapping("/inquiry")
public ListWrapperResponse<InquiryListResponse> getInquiry(@RequestParam(required = false) String category) {
return null;
return ListWrapperResponse.of(adminOverallService.getInquiry(category));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ void getClubPaymentWithAssignedTerm() {
}

@Test
@DisplayName("카테고리별 문의를 확인할 수 있다.")
void findByCategoryOrderByCreatedAtDesc() {
// Given
School school = createSchool("ajou.ac.kr");
Expand All @@ -228,6 +229,29 @@ void findByCategoryOrderByCreatedAtDesc() {
assertThat(result.get(0).inquiryContent()).isEqualTo("Content1");
}

@Test
@DisplayName("전체 문의를 확인 할 수 있다.")
void findOrderByCreatedAtDesc() {
// Given
School school = createSchool("ajou.ac.kr");
Member member1 = createMember(school, "testProvideId2", "박상준", "[email protected]");
Inquiry inquiry1 = Inquiry.create("Content1", InquiryCategory.INQUIRY, member1);
Inquiry inquiry2 = Inquiry.create("Content2", InquiryCategory.ETC, member1);
inquiryRepository.save(inquiry1);
inquiryRepository.save(inquiry2);

// When
List<InquiryListResponse> result = adminOverallService.getInquiry(null);

// Then
assertThat(result).hasSize(2)
.extracting("inquiryContent", "inquiryCategory")
.containsExactlyInAnyOrder(
tuple("Content1", InquiryCategory.INQUIRY),
tuple("Content2", InquiryCategory.ETC)
);
}

private Club createClub(School school1, String name, String englishName) {
Club club = Club.builder()
.clubName(name)
Expand Down

0 comments on commit 474c3ec

Please sign in to comment.