-
Notifications
You must be signed in to change notification settings - Fork 0
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
[OMCT-369] 피드 목록 조회 테스트 추가 #194
Conversation
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.
가장 어렵고 까다로웠을 테스트 같은데 굉장히 잘 해결해주셧네요!!
given(feedRepository.findAllByCursor( | ||
eq(myPageMemberId), | ||
anyBoolean(), | ||
eq(hobby), | ||
eq(sortCondition), | ||
eq(parameters.cursorId()), | ||
eq(pageSize) | ||
) |
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.
모든 내용을 eq를 사용해서 해결하신 이유가 있나요?
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.
anyBoolean()을 사용려다보니 matcher로 통일해야 해서 그렇게 했습니다.
Long myPageMemberId = 1L; | ||
FeedSortCondition sortCondition = FeedSortCondition.RECENT; | ||
Member member = MemberBuilder.build(memberId); | ||
int pageSize = parameters.size() == null ? DEFAULT_PAGE_SIZE : parameters.size(); |
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.
내부 로직에 있을텐데 이렇게 해주신 이유가 있나요?
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.
내부 로직과 별개로 내부 동작이 옳바르게 작동되는지 확인하기 위해 테스트용 데이터를 만들었습니다.
이 과정에서 내부와 로직이 같을 수 있다고 생각합니다
예로들어 pageSize는 테스트에서 CursorPageParameters 객체의 size 값이 null 일 때 DEFAULT_PAGE_SIZE로 반환되는지 확인하기 위한 데이터를 직접 만들고 있습니다. 이 코드는 내부와 동작이 유사할 수 있지만 리팩토링을 하거나 코드를 수정할 때 도움이 된다고 생각합니다.
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.
복잡한 테스트인데 잘 짜주셨네요👍
📌 PR 종류
어떤 종류의 PR인지 아래 항목 중에 체크 해주세요.
📌 어떤 기능이 추가 되었나요?
Issue Number
OMCT-369
기능 설명
피드 목록 조회 테스트 추가
📌 기존에 있던 기능에 영향을 주나요?