-
Notifications
You must be signed in to change notification settings - Fork 1
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
refactor : 약속 개설 API 구현 #250
Changes from all commits
a0c9548
a30d0c2
073ac95
132a4d0
934cfb7
ab2ecfe
3d6b210
9901111
183bb40
4c2d9ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.ody.meeting.service; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.junit.jupiter.api.Assertions.assertAll; | ||
|
||
import com.ody.common.BaseServiceTest; | ||
import com.ody.common.Fixture; | ||
import com.ody.meeting.domain.Meeting; | ||
import com.ody.meeting.dto.request.MeetingSaveRequestV1; | ||
import com.ody.meeting.dto.response.MeetingSaveResponseV1; | ||
import com.ody.util.InviteCodeGenerator; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
class MeetingServiceTest extends BaseServiceTest { | ||
|
||
@Autowired | ||
MeetingService meetingService; | ||
|
||
@DisplayName("약속 저장 및 초대 코드 갱신에 성공한다") | ||
@Test | ||
void saveV1Success() { | ||
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. [질문] 단순한 궁금증인데 콜리는 "약속 저장 및 초대 코드 갱신에 성공"했다는 것을 검증하기 위해 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.
마침 고민하고 있던 부분인데 카키가 좋은 화두를 던져줘서 생각을 정리할 계기가 된 것 같아요. 특히 save method에는 객체 저장이후에 update문이 들어가기 때문에 만약 update문이 없었다면 저도 카키처럼 id 비교만으로 충분하다 생각합니다! 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. 콜리 의견에 동의해요. 테스트 유지보수가 힘들지만 제 경험인데, 테스트 코드에서는 다 pass 돼서 문제가 없다고 생각했는데 |
||
Meeting testMeeting = Fixture.ODY_MEETING1; | ||
MeetingSaveRequestV1 request = new MeetingSaveRequestV1( | ||
testMeeting.getName(), | ||
testMeeting.getDate(), | ||
testMeeting.getTime(), | ||
testMeeting.getTarget().getAddress(), | ||
testMeeting.getTarget().getLatitude(), | ||
testMeeting.getTarget().getLongitude() | ||
); | ||
|
||
MeetingSaveResponseV1 response = meetingService.saveV1(request); | ||
|
||
assertAll( | ||
() -> assertThat(response.name()).isEqualTo(request.name()), | ||
() -> assertThat(response.date()).isEqualTo(request.date()), | ||
() -> assertThat(response.time()).isEqualTo(request.time()), | ||
() -> assertThat(response.targetAddress()).isEqualTo(request.targetAddress()), | ||
() -> assertThat(response.targetLatitude()).isEqualTo(request.targetLatitude()), | ||
() -> assertThat(response.targetLongitude()).isEqualTo(request.targetLongitude()), | ||
() -> assertThat(InviteCodeGenerator.decode(response.inviteCode())).isEqualTo(response.id()) | ||
); | ||
} | ||
} |
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.
v1 테스트까지 👍🏻
제가 까먹어버렸네요 바로 참여 V1 API 테스트 추가 하러 갑니다