feat: chapter clear cookie/#654#657
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request reduces the cookie rewards for clearing chapters and sections in the roadmap V2 system from 300 to 100 and 3000 to 1000, respectively. The associated unit tests have been updated to reflect these new reward values. The review suggests improving the readability and maintainability of the tests by replacing magic numbers with explicit calculations or local constants for reward values.
| assertThat(result.isChapterCleared()).isTrue(); | ||
| assertThat(result.nextChapterId()).isEqualTo(21L); | ||
| assertThat(userCaptor.getValue().totalCookie()).isEqualTo(1300); | ||
| assertThat(userCaptor.getValue().totalCookie()).isEqualTo(1100); |
Contributor
There was a problem hiding this comment.
Comment on lines
+141
to
147
| assertThat(userCaptor.getValue().totalCookie()).isEqualTo(1600); | ||
| assertThat(historyCaptor.getAllValues()) | ||
| .extracting(UserGoodsHistory::goodsActingCategory, UserGoodsHistory::variation) | ||
| .containsExactly( | ||
| org.assertj.core.groups.Tuple.tuple(GoodsActingCategory.ROADMAP_V2_CHAPTER_REWARD, 300), | ||
| org.assertj.core.groups.Tuple.tuple(GoodsActingCategory.ROADMAP_V2_SECTION_REWARD, 3000) | ||
| org.assertj.core.groups.Tuple.tuple(GoodsActingCategory.ROADMAP_V2_CHAPTER_REWARD, 100), | ||
| org.assertj.core.groups.Tuple.tuple(GoodsActingCategory.ROADMAP_V2_SECTION_REWARD, 1000) | ||
| ); |
Contributor
There was a problem hiding this comment.
테스트에 사용된 매직 넘버(1600, 100, 1000)는 코드의 가독성과 유지보수성을 저해합니다. 보상 값을 지역 상수로 선언하고, 이를 사용하여 예상 결과를 계산하는 방식으로 리팩터링하는 것을 권장합니다. 이렇게 하면 테스트의 의도가 명확해지고 향후 보상 값이 변경될 때 수정이 용이해집니다.
final int chapterReward = 100;
final int sectionReward = 1000;
assertThat(userCaptor.getValue().totalCookie()).isEqualTo(500 + chapterReward + sectionReward);
assertThat(historyCaptor.getAllValues())
.extracting(UserGoodsHistory::goodsActingCategory, UserGoodsHistory::variation)
.containsExactly(
org.assertj.core.groups.Tuple.tuple(GoodsActingCategory.ROADMAP_V2_CHAPTER_REWARD, chapterReward),
org.assertj.core.groups.Tuple.tuple(GoodsActingCategory.ROADMAP_V2_SECTION_REWARD, sectionReward)
);
chaeyn
approved these changes
Apr 11, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
변경사항
관련 이슈
Closes #
추가 컨텍스트