Skip to content
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 @@ -34,6 +34,8 @@ class CommentLikeCommandServiceTest extends IntegrationTest {
void createCommentLike() {
//given, when
CommentLike commentLike = createAndGetSavedCommentLike();
int count = commentLikeRepository.countByCommentId(commentLike.getCommentId());

//then
assertThat(commentLike).isNotNull();
}
Expand All @@ -46,7 +48,7 @@ void deleteCommentLike() {

// when
commentLikeService.deleteCommentLike(commentLike.getCommentId(),commentLike.getId(), commentLike.getUserId());

int count = commentLikeRepository.countByCommentId(commentLike.getCommentId());
// then
assertThat(commentLikeRepository.existsById(commentLike.getId())).isFalse();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.springframework.restdocs.payload.JsonFieldType;

import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.doNothing;
import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.delete;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
Expand Down Expand Up @@ -47,7 +46,7 @@ void createCommentLike() throws Exception {
.description("댓글좋아요 ID"),
fieldWithPath("likeCount")
.type(JsonFieldType.NUMBER)
.description("댓글좋아요 ID")
.description("댓글좋아요 ")
)
));
}
Expand All @@ -58,7 +57,7 @@ void createCommentLike() throws Exception {
void deleteCommentLike() throws Exception {
//given
CommentLikeIdResponse commentLikeIdResponse =
new CommentLikeIdResponse(commentLikeId, 10);
new CommentLikeIdResponse(null, 10);
given(commentLikeService.deleteCommentLike(commentId, commentLikeId, userId))
.willReturn(commentLikeIdResponse);
//when then
Expand All @@ -73,10 +72,11 @@ void deleteCommentLike() throws Exception {
responseFields(
fieldWithPath("commentLikeId")
.type(JsonFieldType.NUMBER)
.description("댓글좋아요 ID"),
.description("댓글좋아요 ID")
.optional(),
fieldWithPath("likeCount")
.type(JsonFieldType.NUMBER)
.description("댓글좋아요 ID")
.description("댓글좋아요 ")
)
));
}
Expand Down