Skip to content

Commit

Permalink
test: 짧은 리뷰 dto hasLike -> isLike로 변경 #132
Browse files Browse the repository at this point in the history
  • Loading branch information
hanyMK committed Nov 26, 2023
1 parent 6840b98 commit 0e817a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void checkShortReviewLike() throws Exception{
//then
actions
.andExpect(status().isOk())
.andExpect(jsonPath("$.hasLike").exists())
.andExpect(jsonPath("$.isLike").exists())
.andDo(document("likes/shortReview/checkLike/success",
preprocessRequest(prettyPrint()),
preprocessResponse(prettyPrint()),
Expand All @@ -181,7 +181,7 @@ void checkShortReviewLike() throws Exception{
.description("짧은 리뷰 고유 식별자")
),
responseFields(
fieldWithPath("hasLike")
fieldWithPath("isLike")
.type(JsonFieldType.BOOLEAN)
.description("짧은 리뷰 좋아요 존재 시 true, 부재 시 false"))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import io.oduck.api.domain.review.entity.ShortReview;
import io.oduck.api.domain.review.repository.ShortReviewRepository;
import io.oduck.api.domain.reviewLike.dto.ShortReviewLikeReqDto.ShortReviewLikeReq;
import io.oduck.api.domain.reviewLike.dto.ShortReviewLikeResDto.HasLikeRes;
import io.oduck.api.domain.reviewLike.dto.ShortReviewLikeResDto.IsLikeRes;
import io.oduck.api.domain.reviewLike.entity.ShortReviewLike;
import io.oduck.api.domain.reviewLike.repository.ShortReviewLikeRepository;
import io.oduck.api.domain.reviewLike.service.ShortReviewLikeServiceImpl;
Expand Down Expand Up @@ -103,21 +103,21 @@ class CheckLike{
void checkShortReviewLikeTrue(){
given(shortReviewLikeRepository.findByMemberIdAndShortReviewId(member.getId(), shortReview.getId())).willReturn(Optional.of(shortReviewLike));

HasLikeRes hasLikeRes = shortReviewLikeService.checkReviewLike(shortReview.getId(), member.getId());
IsLikeRes hasLikeRes = shortReviewLikeService.checkReviewLike(shortReview.getId(), member.getId());

assertNotNull(hasLikeRes);
assertTrue(hasLikeRes.isHasLike());
assertTrue(hasLikeRes.getIsLike());
}

@Test
@DisplayName("짧은 리뷰 좋아요 없을 시 false")
void checkShortReviewLikeFalse(){
given(shortReviewLikeRepository.findByMemberIdAndShortReviewId(member.getId(), shortReview.getId())).willReturn(Optional.empty());

HasLikeRes hasLikeRes = shortReviewLikeService.checkReviewLike(shortReview.getId(), member.getId());
IsLikeRes hasLikeRes = shortReviewLikeService.checkReviewLike(shortReview.getId(), member.getId());

assertNotNull(hasLikeRes);
assertFalse(hasLikeRes.isHasLike());
assertFalse(hasLikeRes.getIsLike());
}
}
}

0 comments on commit 0e817a8

Please sign in to comment.