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

[WHD-293] Fix: inquiry test #64

Merged
merged 1 commit into from
Dec 5, 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 @@ -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
Loading