Skip to content

Commit

Permalink
[test] : 채팅방 상세조회 API 통합 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
hyun2371 committed Sep 27, 2024
1 parent 9f2b090 commit 7cdef65
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,25 @@ void createChatRoom() throws Exception {
.andExpect(status().isOk());
}

@DisplayName("[채팅방 아이디로 채팅방을 상세조회할 수 있다.]")
@Test
void getChatRoomById() throws Exception {
Member inquirer = memberRepository.save(MemberFixture.member4());
QuestionPost questionPost = questionPostRepository.save(QuestionPostFixture.questionPost(inquirer));
ChatRoom chatRoom = chatRoomRepository.save(ChatRoomFixture.chatRoom(questionPost, inquirer, loginMember));

mockMvc.perform(get("/api/chat-rooms/{chatRoomId}", chatRoom.getId())
.cookie(accessToken))
.andExpect(status().isOk())
.andExpect(jsonPath("$.questionPostId").value(questionPost.getId()))
.andExpect(jsonPath("$.targetJobGroup").value(questionPost.getJobGroup().getLabel()))
.andExpect(jsonPath("$.title").value(questionPost.getTitle()))
.andExpect(jsonPath("$.receiverInfo.memberId").value(inquirer.getId()))
.andExpect(jsonPath("$.receiverInfo.nickname").value(inquirer.getNickname()))
.andExpect(jsonPath("$.receiverInfo.memberJobGroup").value(inquirer.getJobGroup().getLabel()))
.andExpect(jsonPath("$.receiverInfo.profileImageNo").value(inquirer.getProfileImageNo()));
}

@DisplayName("[답변자가 채팅 요청을 수락할 수 있다.]")
@Test
void acceptChatRoom() throws Exception {
Expand Down

0 comments on commit 7cdef65

Please sign in to comment.