diff --git a/backend/src/docs/index.adoc b/backend/src/docs/index.adoc index 5d1ee08f..bd176ec9 100644 --- a/backend/src/docs/index.adoc +++ b/backend/src/docs/index.adoc @@ -12,3 +12,4 @@ include::auth.adoc[] include::path.adoc[] include::plan.adoc[] include::place.adoc[] +include::member.adoc[] diff --git a/backend/src/docs/member.adoc b/backend/src/docs/member.adoc index bad4a425..7908e689 100644 --- a/backend/src/docs/member.adoc +++ b/backend/src/docs/member.adoc @@ -4,3 +4,7 @@ :toc: left :toclevels: 4 +== Member +=== 닉네임 중복 검색 +operation::get duplicate nickname[snippets='http-request,http-response'] + diff --git a/backend/src/test/java/com/twtw/backend/domain/member/controller/MemberControllerTest.java b/backend/src/test/java/com/twtw/backend/domain/member/controller/MemberControllerTest.java new file mode 100644 index 00000000..34bc56c5 --- /dev/null +++ b/backend/src/test/java/com/twtw/backend/domain/member/controller/MemberControllerTest.java @@ -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())); + } +} diff --git a/backend/src/test/java/com/twtw/backend/domain/path/controller/PathControllerTest.java b/backend/src/test/java/com/twtw/backend/domain/path/controller/PathControllerTest.java index adab02c6..d324f4a6 100644 --- a/backend/src/test/java/com/twtw/backend/domain/path/controller/PathControllerTest.java +++ b/backend/src/test/java/com/twtw/backend/domain/path/controller/PathControllerTest.java @@ -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 @@ -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