Skip to content

Commit

Permalink
Test: 러닝의 평균 페이스가 올바르게 계산되었는지 확인
Browse files Browse the repository at this point in the history
  • Loading branch information
hee9841 committed Oct 14, 2024
1 parent 9300d51 commit 36f55f8
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,35 @@ void addRunningRecord_goal_distance_same_value() {
assertTrue(response.goal().isSuccess());
}

@Test
@DisplayName("러닝의 페이스가 올바르게 계산되었는지 확인한다.")
void addRunningRecord_check_cal_pace() {
// given
RunningRecordRequest request = new RunningRecordRequest(
LocalDateTime.of(2021, 1, 1, 12, 10, 30),
LocalDateTime.of(2021, 1, 1, 13, 12, 10),
"start location",
"end location",
RunningEmoji.VERY_GOOD,
null,
null,
null,
RunningAchievementMode.NORMAL,
new RunningRecordMetricsDtoForAdd(Duration.ofSeconds(1_668), 3_280, 500.0));

Member member = new Member(MemberRole.USER, "nickname1");
RunningRecord expected = createRunningRecord(request, member);

given(memberRepository.findById(1L)).willReturn(Optional.of(member));
given(runningRecordRepository.save(expected)).willReturn(expected);

// when
RunningRecordAddResultResponse response = runningRecordService.addRunningRecord(1L, request);

// then
assertEquals(new Pace(8, 28), response.runningData().averagePace());
}

@Test
@DisplayName("이번 달, 달린 키로 수, 러닝 레벨을 조회한다.")
void getMonthlyRunningSummery() {
Expand Down

0 comments on commit 36f55f8

Please sign in to comment.