Skip to content

Commit

Permalink
[test] : 검증 로직 추가 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
hyun2371 committed Jan 4, 2025
1 parent 185570d commit 5a718e3
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;

import com.dnd.gongmuin.answer.repository.AnswerRepository;
import com.dnd.gongmuin.chat_inquiry.domain.ChatInquiry;
import com.dnd.gongmuin.chat_inquiry.domain.InquiryStatus;
import com.dnd.gongmuin.chat_inquiry.dto.CreateChatInquiryRequest;
import com.dnd.gongmuin.chat_inquiry.repository.ChatInquiryRepository;
import com.dnd.gongmuin.chatroom.repository.ChatMessageRepository;
import com.dnd.gongmuin.chatroom.repository.ChatRoomRepository;
import com.dnd.gongmuin.common.fixture.AnswerFixture;
import com.dnd.gongmuin.common.fixture.ChatInquiryFixture;
import com.dnd.gongmuin.common.fixture.MemberFixture;
import com.dnd.gongmuin.common.fixture.QuestionPostFixture;
Expand All @@ -43,6 +45,9 @@ class ChatInquiryControllerTest extends ApiTestSupport {
@Autowired
private QuestionPostRepository questionPostRepository;

@Autowired
private AnswerRepository answerRepository;

@Autowired
private ChatRoomRepository chatRoomRepository;

Expand All @@ -57,6 +62,7 @@ void teardown() {
creditHistoryRepository.deleteAll();
memberRepository.deleteAll();
questionPostRepository.deleteAll();
answerRepository.deleteAll();
chatInquiryRepository.deleteAll();
chatRoomRepository.deleteAll();
chatMessageRepository.deleteAll();
Expand All @@ -69,11 +75,14 @@ void createChatInquiry() throws Exception {
int previousCredit = loginMember.getCredit();
Member answerer = memberRepository.save(MemberFixture.member5());
QuestionPost questionPost = questionPostRepository.save(QuestionPostFixture.questionPost(loginMember));
answerRepository.save(AnswerFixture.answer(questionPost.getId(), answerer));

CreateChatInquiryRequest request = new CreateChatInquiryRequest(
questionPost.getId(),
answerer.getId(),
INQUIRY_MESSAGE
);

//when & then
mockMvc.perform(post("/api/chat/inquiries")
.cookie(accessToken)
Expand Down

0 comments on commit 5a718e3

Please sign in to comment.