Skip to content

Commit

Permalink
[BE] 문서화 테스트 개선 (#1091)
Browse files Browse the repository at this point in the history
* refactor: LoginDocument mock이용한 테스트로 수정

* refactor(MissionDocumentation): mock이용한 테스트로 수정

* refactor(ProfileDocumentation): mock이용한 테스트로 수정 + response fixture 생성

* refactor(CommentDocumentation): mock 이용한 테스트로 수정

* refactor(MemberDocumentation, MemberReactionDocumentation): mock 이용한 테스트로 수정

* refactor(SessionMemberDocumentation): mock 이용한 테스트로 수정

* refactor(TagDocumentation): mock 이용한 테스트로 수정

* refactor(StudylogOverviewDocumentation): mock 이용한 테스트로 수정

* feat: comment count svg 변경 (#1063)

* chore: comment svg 수정

* chore: comment svg 수정

* feat: 로드맵을 위한 하위 컴포넌트 구현 (#1047)

* chore: storybook 사용을 위해 reactDocgen 에러 설정

* feat: 상위에서 크기를 제어하는 ResponsiveButton 컴포넌트 구현

* feat: LabelledImage 컴포넌트 구현

* feat: KeywordSection 컴포넌트 구현

* refactor: Omit -> Pick으로 타입 변경

* feat: fontSize를 Style Props 인자로 내려주기

* feat: 로드맵을 위한 하위 컴포넌트 구현(sidesheet modal) (#1048)

* refactor(StudylogRssFeedDocumentation): mock 이용한 테스트로 수정

* chore: 자바 버전을 8에서 9로 변경

* test(StudylogRssFeedDocumentation): 응답 fixture로 빼기

* chore: 자바9 -> 8 변경

* chore: 자바9 -> 8 변경

Co-authored-by: JUDONGHYEOK <[email protected]>
Co-authored-by: 김의진 <[email protected]>
Co-authored-by: Marco <[email protected]>
  • Loading branch information
4 people authored and hanull committed Oct 27, 2022
1 parent 439f63d commit 141c217
Show file tree
Hide file tree
Showing 27 changed files with 1,043 additions and 761 deletions.
1 change: 1 addition & 0 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,4 @@ sonarqube {
property "sonar.host.url", "https://sonarcloud.io"
}
}
targetCompatibility = JavaVersion.VERSION_1_8
11 changes: 10 additions & 1 deletion backend/src/documentation/adoc/session.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,13 @@ operation::sessions/create[snippets='http-request,http-response']

=== 세션 목록 조회

operation::sessions/list[snippets='http-request,http-response']
operation::sessions/list[snippets='http-request,http-response']

=== 세션에 자신을 등록

operation::sessions/register/me[snippets='http-request,http-response']

=== 세션에서 자신을 삭제

operation::sessions/delete/me[snippets='http-request,http-response']

Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ public class NewDocumentation {
@BeforeEach
public void setUp(WebApplicationContext webApplicationContext, RestDocumentationContextProvider restDocumentation) {
given = RestAssuredMockMvc.given().mockMvc(MockMvcBuilders.webAppContextSetup(webApplicationContext)
.apply(documentationConfiguration(restDocumentation).operationPreprocessors()
.withRequestDefaults(prettyPrint())
.withResponseDefaults(prettyPrint()))
.build()).log().all();
.apply(documentationConfiguration(restDocumentation).operationPreprocessors()
.withRequestDefaults(prettyPrint())
.withResponseDefaults(prettyPrint()))
.build()).log().all();

accessToken = "accessToken";
}

}
121 changes: 121 additions & 0 deletions backend/src/documentation/java/wooteco/prolog/ResponseFixture.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
package wooteco.prolog;

import static wooteco.prolog.member.domain.Role.CREW;

import java.sql.Date;
import java.time.Instant;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import wooteco.prolog.member.application.dto.MemberResponse;
import wooteco.prolog.member.domain.Member;
import wooteco.prolog.member.domain.Role;
import wooteco.prolog.session.application.dto.MissionResponse;
import wooteco.prolog.session.application.dto.SessionResponse;
import wooteco.prolog.studylog.application.dto.CalendarStudylogResponse;
import wooteco.prolog.studylog.application.dto.CommentMemberResponse;
import wooteco.prolog.studylog.application.dto.CommentResponse;
import wooteco.prolog.studylog.application.dto.CommentsResponse;
import wooteco.prolog.studylog.application.dto.MemberTagResponse;
import wooteco.prolog.studylog.application.dto.StudylogResponse;
import wooteco.prolog.studylog.application.dto.StudylogRssFeedResponse;
import wooteco.prolog.studylog.application.dto.StudylogsResponse;
import wooteco.prolog.studylog.application.dto.TagResponse;

public class ResponseFixture {

public static final SessionResponse SESSION_RESPONSE =
new SessionResponse(1L, "세션1");

public static final MissionResponse MISSION_RESPONSE1 =
new MissionResponse(1L, "지하철 노선도 미션", SESSION_RESPONSE);

public static final MissionResponse MISSION_RESPONSE2 =
new MissionResponse(1L, "로또 미션", SESSION_RESPONSE);

public static final MemberResponse MEMBER_RESPONSE = new MemberResponse(
1L,
"soulG",
"잉",
CREW,
"https://avatars.githubusercontent.com/u/52682603?v=4"
);

public static final StudylogResponse STUDYLOG_RESPONSE1 = new StudylogResponse(
1L,
MEMBER_RESPONSE,
LocalDateTime.now(),
LocalDateTime.now(),
SESSION_RESPONSE,
MISSION_RESPONSE1,
"JAVA",
"Spring Data JPA를 학습함.",
Arrays.asList(new TagResponse(3L, "java"), new TagResponse(4L, "jpa")),
Collections.emptyList(),
false,
false,
0,
false,
0
);

private static final StudylogResponse STUDYLOG_RESPONSE2 = new StudylogResponse(
2L,
MEMBER_RESPONSE,
LocalDateTime.now(),
LocalDateTime.now(),
SESSION_RESPONSE,
MISSION_RESPONSE2,
"SPA",
"SPA 방식으로 앱을 구현하였음.\nrouter 를 구현 하여 이용함.\n",
Arrays.asList(new TagResponse(1L, "spa"), new TagResponse(2L, "router")),
Collections.emptyList(),
false,
false,
0,
false,
0
);

public static final StudylogsResponse STUDYLOGS_RESPONSE = new StudylogsResponse(Arrays.asList(
STUDYLOG_RESPONSE1,
STUDYLOG_RESPONSE2
), 2L, 1, 1);

public static final String COMMENT = "댓글의 내용입니다.";
public static final CommentsResponse COMMENTS_RESPONSE = new CommentsResponse(Arrays.asList(
new CommentResponse(1L,
new CommentMemberResponse(1L, "yboy", "잉",
"https://avatars.githubusercontent.com/u/52682603?v=4", "CREW")
, COMMENT,
LocalDateTime.now())
));

public static final Member MEMBER
= new Member("yboy", "잉", Role.CREW, 1L, GithubResponses.소롱.getAvatarUrl());

public static final TagResponse TAG_RESPONSE1 = new TagResponse(1L, "자바");
public static final TagResponse TAG_RESPONSE2 = new TagResponse(2L, "코틀린");

public static final List<TagResponse> TAG_RESPONSES = Arrays.asList(
TAG_RESPONSE1,
TAG_RESPONSE2
);

public static final List<MemberTagResponse> MEMBER_TAB_RESPONSES = Arrays.asList(
new MemberTagResponse(TAG_RESPONSE1, 2),
new MemberTagResponse(TAG_RESPONSE2, 2)
);

public static final List<CalendarStudylogResponse> CALENDER_STUDYLOG_RESPONSES = Arrays.asList(
new CalendarStudylogResponse(1L, "instanceOf()를 지양하자", LocalDateTime.now().minusMonths(2),
LocalDateTime.now()),
new CalendarStudylogResponse(2L, "JPA 쿼리 개선기", LocalDateTime.now().minusMonths(1),
LocalDateTime.now())
);

public static final List<StudylogRssFeedResponse> STUDYLOG_RSS_FEED_RESPONSES = Arrays.asList(
new StudylogRssFeedResponse("Prolog | 우아한테크코스 학습로그 저장소", "자바", "잉", "http://localhost:8080",
Date.from(Instant.now())));
}
Loading

0 comments on commit 141c217

Please sign in to comment.