-
Notifications
You must be signed in to change notification settings - Fork 0
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
[feat #186] 질문글 삭제 API #187
base: dev
Are you sure you want to change the base?
Conversation
Code Coverage
|
Test Results 28 files 28 suites 14s ⏱️ Results for commit c92e825. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!
작성자 유효성 검증이 없어서 추가 후 승인하겠습니다!
public DeleteQuestionPostResponse deleteQuestionPost( | ||
Long questionPostId | ||
){ | ||
QuestionPost questionPost = questionPostRepository.findById(questionPostId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
작성자 본인의 게시글이 맞는지 확인하는 유효성 검사가 누락 되어있습니다!
){ | ||
QuestionPost questionPost = questionPostRepository.findById(questionPostId) | ||
.orElseThrow(() -> new NotFoundException(QuestionPostErrorCode.NOT_FOUND_QUESTION_POST)); | ||
if (answerRepository.existsByQuestionPostId(questionPostId)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기도 메서드 추출하면 깔끔해질 것 같아요!
}); | ||
} | ||
|
||
private void saveRefundCreditHistory(Member member, int reward){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
//when & then | ||
assertThrows(ValidationException.class, | ||
() -> questionPostService.deleteQuestionPost(questionPostId)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
삭제할 수 없을 때 발생하는 예외 문구가 의도와 맞는지 확인하면 더 좋은 테스트 코드가 될 것 같아요!
관련 이슈
📑 작업 상세 내용
💫 작업 요약
🔍 중점적으로 리뷰 할 부분
refundClosedQuestionPosts()
로 수정했습니다.