Skip to content
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

Merged
merged 5 commits into from
Nov 29, 2023

Conversation

Curry4182
Copy link
Contributor

📌 PR 종류

어떤 종류의 PR인지 아래 항목 중에 체크 해주세요.

  • 🐛 버그 수정
  • ✨ 기능 추가
  •  테스트 추가
  • 🎨 코드 스타일 변경 (formatting, local variables)
  • 🔨 리팩토링 (기능 변경 X)
  • 💚 빌드 관련 수정
  • 📝 문서 내용 수정
  • 그 외, 어떤 종류인지 기입 바람:

📌 어떤 기능이 추가 되었나요?

Issue Number

OMCT-369

기능 설명

피드 목록 조회 테스트 추가

  • 피드 목록 조회 테스를 생성하는데 필요한 데이터를 반환하는 fixture를 만들었습니다. 2e2082e aa89187
  • 피드 목록 조회 테스트를 추가하였습니다. d12265c

📌 기존에 있던 기능에 영향을 주나요?

  • 아니요

@Curry4182 Curry4182 added test Good for newcomers SPRINT7 Extra attention is needed labels Nov 28, 2023
@Curry4182 Curry4182 self-assigned this Nov 28, 2023
Copy link
Member

@HandmadeCloud HandmadeCloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

가장 어렵고 까다로웠을 테스트 같은데 굉장히 잘 해결해주셧네요!!

Comment on lines 86 to 93
given(feedRepository.findAllByCursor(
eq(myPageMemberId),
anyBoolean(),
eq(hobby),
eq(sortCondition),
eq(parameters.cursorId()),
eq(pageSize)
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

모든 내용을 eq를 사용해서 해결하신 이유가 있나요?

Copy link
Contributor Author

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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

내부 로직에 있을텐데 이렇게 해주신 이유가 있나요?

Copy link
Contributor Author

@Curry4182 Curry4182 Nov 29, 2023

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로 반환되는지 확인하기 위한 데이터를 직접 만들고 있습니다. 이 코드는 내부와 동작이 유사할 수 있지만 리팩토링을 하거나 코드를 수정할 때 도움이 된다고 생각합니다.

Copy link
Contributor

@Yiseull Yiseull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

복잡한 테스트인데 잘 짜주셨네요👍

Yiseull

This comment was marked as duplicate.

@Curry4182 Curry4182 merged commit f05a6c1 into main Nov 29, 2023
1 check passed
@Curry4182 Curry4182 deleted the OMCT-369-feed-get-list-test branch November 29, 2023 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SPRINT7 Extra attention is needed test Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants