-
Notifications
You must be signed in to change notification settings - Fork 8
chore: 전체 게시글 조회 시 첫 번째 이미지 url에 해당하는 변수명 변경 #433
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
Changes from 2 commits
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 |
|---|---|---|
|
|
@@ -166,4 +166,35 @@ void setUp() { | |
| () -> assertThat(redisService.isKeyExists(validateKey)).isTrue() | ||
| ); | ||
| } | ||
|
|
||
| @Test | ||
| void 게시글_목록_조회시_첫번째_이미지를_썸네일로_반환한다() { | ||
| // given | ||
| String firstImageUrl = "first-thumbnail-url"; | ||
| String secondImageUrl = "second-thumbnail-url"; | ||
| postImageFixture.게시글_이미지(firstImageUrl, post1); | ||
| postImageFixture.게시글_이미지(secondImageUrl, post1); | ||
|
|
||
| // when | ||
| List<PostListResponse> actualResponses = postQueryService.findPostsByCodeAndPostCategory( | ||
| BoardCode.FREE.name(), | ||
| PostCategory.전체.name() | ||
| ); | ||
|
|
||
| // then | ||
| PostListResponse post1Response = actualResponses.stream() | ||
| .filter(p -> p.id().equals(post1.getId())) | ||
| .findFirst() | ||
| .orElseThrow(); | ||
|
|
||
| PostListResponse post3Response = actualResponses.stream() | ||
| .filter(p -> p.id().equals(post3.getId())) | ||
| .findFirst() | ||
| .orElseThrow(); | ||
|
|
||
| assertAll( | ||
| () -> assertThat(post1Response.postThumbnailUrl()).isEqualTo(firstImageUrl), | ||
| () -> assertThat(post3Response.postThumbnailUrl()).isNull() | ||
| ); | ||
|
Collaborator
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. 조금 사소한 부분일수도 있는데요..! 지금의 테스트는 두가지 동작을 테스트하고 있는 것 같아요.
이 두가지를 각각의 테스트로 나누어 "테스트가 한가지만 검증하도록" 하는 것도 좋을 것 같습니다~
Member
Author
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 comment
The reason will be displayed to describe this comment to others. Learn more.
이 pr과 관련은 없지만 불필요한 Long타입 나중에 한 번 싹 고치는 pr 제가 올리겠습니다!