-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BE] refactor: 꿀조합 랭킹 알고리즘 개선 (#755)
* feat: 꿀조합 랭킹 점수 계산 로직 추가 * refactor: 꿀조합 랭킹 기능 수정 * test: 꿀조합 랭킹 관련 테스트 추가 * refactor: import 정렬 * test: 상황에 따른 꿀조합 랭킹 서비스 테스트 추가 * refactor: Objects import 추가 * fix: 충돌 해결
- Loading branch information
1 parent
9467d94
commit 0532bbe
Showing
9 changed files
with
259 additions
and
19 deletions.
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
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
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
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
36 changes: 36 additions & 0 deletions
36
backend/src/test/java/com/funeat/recipe/domain/RecipeTest.java
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.funeat.recipe.domain; | ||
|
||
import static com.funeat.fixture.MemberFixture.멤버_멤버1_생성; | ||
import static com.funeat.fixture.RecipeFixture.레시피_생성; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.time.LocalDateTime; | ||
import org.junit.jupiter.api.DisplayNameGeneration; | ||
import org.junit.jupiter.api.DisplayNameGenerator; | ||
import org.junit.jupiter.api.Nested; | ||
import org.junit.jupiter.api.Test; | ||
|
||
@SuppressWarnings("NonAsciiCharacters") | ||
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) | ||
class RecipeTest { | ||
|
||
@Nested | ||
class calculateRankingScore_성공_테스트 { | ||
|
||
@Test | ||
void 꿀조합_좋아요_수와_꿀조합_생성_시간으로_해당_꿀조합의_랭킹_점수를_구할_수_있다() { | ||
// given | ||
final var member = 멤버_멤버1_생성(); | ||
final var favoriteCount = 4L; | ||
final var recipe = 레시피_생성(member, favoriteCount, LocalDateTime.now().minusDays(1L)); | ||
|
||
final var expected = favoriteCount / Math.pow(2.0, 0.1); | ||
|
||
// when | ||
final var actual = recipe.calculateRankingScore(); | ||
|
||
// then | ||
assertThat(actual).isEqualTo(expected); | ||
} | ||
} | ||
} |
Oops, something went wrong.