Skip to content

Commit

Permalink
Merge pull request #32 from HongDam-org/feat/member-api-docs
Browse files Browse the repository at this point in the history
[FEAT] member api docs
  • Loading branch information
jinjoo-lab authored Oct 6, 2023
2 parents 2109878 + ca0ecb7 commit 257aaa3
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 6 deletions.
1 change: 1 addition & 0 deletions backend/src/docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ include::auth.adoc[]
include::path.adoc[]
include::plan.adoc[]
include::place.adoc[]
include::member.adoc[]
4 changes: 4 additions & 0 deletions backend/src/docs/member.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
:toc: left
:toclevels: 4

== Member
=== 닉네임 중복 검색
operation::get duplicate nickname[snippets='http-request,http-response']

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.twtw.backend.domain.member.controller;

import static com.twtw.backend.support.docs.ApiDocsUtils.getDocumentRequest;
import static com.twtw.backend.support.docs.ApiDocsUtils.getDocumentResponse;

import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import com.twtw.backend.domain.member.service.MemberService;
import com.twtw.backend.support.docs.RestDocsTest;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.ResultActions;

@DisplayName("MemberController의")
@WebMvcTest(MemberController.class)
public class MemberControllerTest extends RestDocsTest {
@MockBean private MemberService memberService;

@Test
@DisplayName("닉네임이 중복되었는가")
void duplicate() throws Exception {
final ResultActions perform =
mockMvc.perform(
get("/member/duplicate/{name}", "진주원")
.contentType(MediaType.APPLICATION_JSON)
.header(
"Authorization",
"Bearer wefa3fsdczf32.gaoiuergf92.gb5hsa2jgh"));

// then
perform.andExpect(status().isOk());
// docs

perform.andDo(print())
.andDo(
document(
"get duplicate nickname",
getDocumentRequest(),
getDocumentResponse()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ void searchCarPath() throws Exception {
.content(
toRequestBody(
new SearchCarPathRequest(
"",
"",
"37.636040,126.827507",
"37.644998,126.832659",
"",
SearchPathOption.TRAFAST,
SearchPathFuel.DIESEL,
0)))
1)))
.contentType(MediaType.APPLICATION_JSON));

// then
Expand Down Expand Up @@ -93,12 +93,12 @@ void searchPedPath() throws Exception {
.content(
toRequestBody(
new SearchCarPathRequest(
"",
"",
"37.636040,126.827507",
"37.644998,126.832659",
"",
SearchPathOption.TRAFAST,
SearchPathFuel.DIESEL,
0)))
1)))
.contentType(MediaType.APPLICATION_JSON));

// then
Expand Down

0 comments on commit 257aaa3

Please sign in to comment.