Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public RecentPostsResponse withMemberDetail(String name, String profileImage) {
.category(this.category)
.content(this.content)
.isHotPost(this.isHotPost)
.url(this.url)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.mockito.junit.jupiter.MockitoExtension;
import org.sopt.app.application.auth.dto.PlaygroundAuthTokenInfo.RefreshedToken;
import org.sopt.app.application.playground.dto.PlayGroundPostCategory;
import org.sopt.app.application.playground.dto.PlayGroundPostDetailResponse;
import org.sopt.app.application.playground.dto.PlaygroundPostInfo.PlaygroundPostResponse;
import org.sopt.app.application.playground.dto.PlaygroundProfileInfo.*;
import org.sopt.app.application.playground.PlaygroundAuthService;
Expand Down Expand Up @@ -375,4 +376,45 @@ private RecentPostsResponse createMockCategoryPost(Long id, String title) {
.build();
}

@Test
@DisplayName("HotPost + withMemberDetail 호출 후에도 URL이 유지되는지 검증")
void SUCCESS_testHotPostWithMemberDetailKeepsUrl() {
// given
String token = "dummy-token";
Long hotPostId = 123L;

PlaygroundPostResponse hotPostResponse = new PlaygroundPostResponse(
hotPostId,
"핫 게시글",
"핫 컨텐츠"
);

when(playgroundClient.getPlaygroundHotPost(anyMap()))
.thenReturn(hotPostResponse);

when(playgroundClient.getRecentPosts(anyMap(), anyString()))
.thenReturn(null); // category 없음 처리

when(playgroundClient.getPlayGroundPostDetail(anyMap(), eq(hotPostId)))
.thenReturn(
new PlayGroundPostDetailResponse(
new PlayGroundPostDetailResponse.Member("닉네임", "https://image.url/profile.png"),
null
)
);

// when
List<RecentPostsResponse> results = playgroundAuthService.getRecentPostsWithMemberInfo(token);

// then
assertThat(results).hasSize(1);
RecentPostsResponse post = results.get(0);

assertThat(post.getId()).isEqualTo(hotPostId);
assertThat(post.getTitle()).isEqualTo("핫 게시글");
assertThat(post.getName()).isEqualTo("닉네임");
assertThat(post.getProfileImage()).isEqualTo("https://image.url/profile.png");
assertThat(post.getUrl()).isEqualTo("http://localhost:3000/?feed=123");
}

}