Skip to content

Commit

Permalink
[test] : 채팅 요청 상세 조회 API 메서드 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
hyun2371 committed Nov 22, 2024
1 parent 06b406a commit 6107af5
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ void teardown() {
creditHistoryRepository.deleteAll();
memberRepository.deleteAll();
questionPostRepository.deleteAll();
chatInquiryRepository.deleteAll();
chatRoomRepository.deleteAll();
chatMessageRepository.deleteAll();
}
Expand All @@ -82,6 +83,32 @@ void createChatInquiry() throws Exception {
.andDo(MockMvcResultHandlers.print());
}

@DisplayName("[채팅 요청 아이디로 상세 채팅 요청을 조회할 수 있다.]")
@Test
void getChatInquiryById() throws Exception {
//given
Member chatPartner = memberRepository.save(MemberFixture.member5());
QuestionPost questionPost = questionPostRepository.save(QuestionPostFixture.questionPost(loginMember));
ChatInquiry chatInquiry = chatInquiryRepository.save(
ChatInquiryFixture.chatInquiry(questionPost, loginMember, chatPartner, INQUIRY_MESSAGE)
);

//when & then
mockMvc.perform(get("/api/chat/inquiries/{chatInquiryId}", chatInquiry.getId())
.cookie(accessToken))
.andExpect(status().isOk())
.andExpect(jsonPath("$.chatInquiryId")
.value(chatInquiry.getId()))
.andExpect(jsonPath("$.inquiryStatus")
.value(InquiryStatus.PENDING.getLabel()))
.andExpect(jsonPath("$.chatPartner.memberId")
.value(chatPartner.getId()))
.andExpect(jsonPath("$.isInquirer")
.value(chatInquiry.getInquirer().equals(loginMember)))
.andExpect(jsonPath("$.inquiryStatus")
.value(InquiryStatus.PENDING.getLabel()));
}

@DisplayName("[회원의 채팅 요청 목록을 조회할 수 있다.]")
@Test
void getChatInquiresByMember() throws Exception {
Expand Down

0 comments on commit 6107af5

Please sign in to comment.