-
Notifications
You must be signed in to change notification settings - Fork 4
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
hotfix: 좋아요/싫어요 취소 시, 싫어요 취소해도 좋아요 통계 줄어드는 오류 수정 #473
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
import com.now.naaga.common.exception.BaseExceptionType; | ||
import com.now.naaga.like.application.dto.CancelLikeCommand; | ||
import com.now.naaga.like.domain.PlaceLike; | ||
import com.now.naaga.like.domain.PlaceLikeType; | ||
import com.now.naaga.like.exception.PlaceLikeException; | ||
import com.now.naaga.like.repository.PlaceLikeRepository; | ||
import com.now.naaga.place.domain.Place; | ||
|
@@ -76,6 +77,7 @@ public PlaceLikeServiceTest(final PlaceLikeService placeLikeService, | |
final PlaceLike placeLike = placeLikeBuilder.init() | ||
.place(place) | ||
.player(player) | ||
.placeLikeType(PlaceLikeType.LIKE) | ||
.build(); | ||
final long beforeLikeCount = 10L; | ||
placeStatisticsBuilder.init() | ||
|
@@ -96,6 +98,37 @@ public PlaceLikeServiceTest(final PlaceLikeService placeLikeService, | |
}); | ||
} | ||
|
||
@Test | ||
void 싫어요를_삭제하면_통계가_줄어들지_않는다() { | ||
// given | ||
final Place place = placeBuilder.init() | ||
.build(); | ||
final Player player = playerBuilder.init() | ||
.build(); | ||
final PlaceLike placeLike = placeLikeBuilder.init() | ||
.place(place) | ||
.player(player) | ||
.placeLikeType(PlaceLikeType.DISLIKE) | ||
.build(); | ||
final long beforeLikeCount = 10L; | ||
placeStatisticsBuilder.init() | ||
.place(place) | ||
.likeCount(beforeLikeCount) | ||
.build(); | ||
final CancelLikeCommand cancelLikeCommand = new CancelLikeCommand(player.getId(), place.getId()); | ||
|
||
// when | ||
placeLikeService.cancelLike(cancelLikeCommand); | ||
|
||
// then | ||
final Optional<PlaceLike> findPlaceLike = placeLikeRepository.findById(placeLike.getId()); | ||
final PlaceStatistics findPlaceStatistics = placeStatisticsRepository.findByPlaceId(place.getId()).get(); | ||
assertSoftly(softAssertions -> { | ||
assertThat(findPlaceStatistics.getLikeCount()).isEqualTo(beforeLikeCount); | ||
assertThat(findPlaceLike).isEmpty(); | ||
}); | ||
Comment on lines
+124
to
+129
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 검증 굿 |
||
} | ||
|
||
@Test | ||
void 좋아요가_0개일_때_좋아요를_삭제하면_통계에서_좋아요를_0개로_유지한다() { | ||
// given | ||
|
@@ -106,6 +139,7 @@ public PlaceLikeServiceTest(final PlaceLikeService placeLikeService, | |
final PlaceLike placeLike = placeLikeBuilder.init() | ||
.place(place) | ||
.player(player) | ||
.placeLikeType(PlaceLikeType.LIKE) | ||
.build(); | ||
final long beforeLikeCount = 0L; | ||
placeStatisticsBuilder.init() | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
저희 enum앞에 클래스명을 붙이지 않는것이 컨밴션이였던것으로 기억합니다!