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

test: 팔로우 소식 도메인 테스트 코드 작성 #460

Merged
merged 9 commits into from
Nov 12, 2024

Conversation

penrose15
Copy link
Collaborator

🌱 관련 이슈

📌 작업 내용 및 특이사항

  • 팔로우 소식 도메인 테스트 코드 작성하였습니다. (service, controller)

FollowingMemoryLogServiceTest
image

FollowingLogControllerTest
image

📝 참고사항

  • MemberFixture, MemoryFixture에서 불필요한 메서드, 파라미터를 제거하였습니다.
    • 전체 테스트 결과 전부 통과하였습니다.

[domain-module test]
image

[infrastructure-module:persistence-database test]
image

[presentation-module test]
image

@penrose15 penrose15 added the test label Nov 11, 2024
@penrose15 penrose15 self-assigned this Nov 11, 2024
Copy link

github-actions bot commented Nov 11, 2024

Test Results

100 tests   100 ✅  2s ⏱️
 26 suites    0 💤
 26 files      0 ❌

Results for commit ed8d76a.

♻️ This comment has been updated with latest results.

Copy link
Member

@ywonchae1 ywonchae1 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다 !!!

return result.subList(0, Math.min(result.size(), 11));
}

private boolean cursorIdLt(Long cursorId, FollowingMemoryLog followingMemoryLog) {
Copy link
Member

Choose a reason for hiding this comment

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

요기는 왜 @Override가 없나요??

Copy link
Collaborator Author

@penrose15 penrose15 Nov 12, 2024

Choose a reason for hiding this comment

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

FollowingMemoryLogRepository의 cursorIdLt() 메서드는 FollowingMemoryLogPersistencePort에는 없는 메서드라 @Override 를 할 수 없습니다. 또한 FollowingMemoryLogRepository의 cursorIdLt() 메서드 의 반환 타입은 BooleanExpression로 queryDSL에 종속된 클래스이므로 domain-module에 속한 persistencePort에서 사용할 수 없어 FollowingMemoryLogPersistencePort 인터페이스에 선언하지 않았습니다.

}

public List<FollowingMemoryLog> getFollowingMemoryLogs() {
return this.followingMemoryLogs;
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
Collaborator Author

Choose a reason for hiding this comment

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

네 테스트 코드에서만 사용하는 코드입니다.

Comment on lines +88 to +98
private void saveFollowingMemoryLogs() {
Member member = MemberFixture.make(memberId);
List<Member> members = getMembers();

List<Memory> memories = getMemories(members);
followingMemoryLogRepository.saveFriends(member, members);

for (Memory m : memories) {
followingMemoryLogService.save(new CreateFollowingMemoryCommand(m));
}
}
Copy link
Member

Choose a reason for hiding this comment

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

저희 친구관계가 생기기 전의 log도 저장이 되었나요 !

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

아니요. 해당 메서드는 팔로잉_소식_cursorId_없이_조회() 에서 더미 데이터를 만들기 위해 만들어진 메서드로 Member, Memory를 만든 후, 팔로우 관계를 맺은 상태에서 FollowingMemoryLog를 만드는 로직입니다. 해당 과정이 필요한 이유는 팔로잉 소식 조회 시 Friend 를 조인하여 조회하기 때문입니다.

Copy link
Member

@its-sky its-sky left a comment

Choose a reason for hiding this comment

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

수고하셨습니다~

@penrose15 penrose15 merged commit de9747d into develop Nov 12, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✅ FollowingMemoryLog 도메인 테스트 코드 작성
3 participants