Skip to content

Commit

Permalink
[#16] test: 테스트 형식에 맞춰 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
NaMinhyeok committed Jan 29, 2025
1 parent ef02d6a commit 442abad
Showing 1 changed file with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package org.nexters.jaknaesoserver.controller;

import static com.epages.restdocs.apispec.MockMvcRestDocumentationWrapper.document;
import static com.epages.restdocs.apispec.ResourceDocumentation.headerWithName;
import static com.epages.restdocs.apispec.ResourceDocumentation.resource;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import com.epages.restdocs.apispec.ResourceSnippetParameters;
import com.epages.restdocs.apispec.SimpleType;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand All @@ -34,13 +36,23 @@ void reissueToken() throws Exception {
.andDo(
document(
"token-reissue",
responseFields(
fieldWithPath("result").type(SimpleType.STRING).description("결과"),
fieldWithPath("data.userId").type(SimpleType.NUMBER).description("유저 ID"),
fieldWithPath("data.accessToken").type(SimpleType.STRING).description("액세스 토큰"),
fieldWithPath("data.refreshToken")
.type(SimpleType.STRING)
.description("리프레시 토큰"),
fieldWithPath("error").description("에러"))));
resource(
ResourceSnippetParameters.builder()
.description("리프레시 토큰을 통해 토큰 재발급")
.tag("Auth Domain")
.requestHeaders(headerWithName("Refresh-Token").description("리프레시 토큰"))
.responseFields(
fieldWithPath("result").type(SimpleType.STRING).description("결과"),
fieldWithPath("data.userId")
.type(SimpleType.NUMBER)
.description("유저 ID"),
fieldWithPath("data.accessToken")
.type(SimpleType.STRING)
.description("액세스 토큰"),
fieldWithPath("data.refreshToken")
.type(SimpleType.STRING)
.description("리프레시 토큰"),
fieldWithPath("error").description("에러").optional())
.build())));
}
}

0 comments on commit 442abad

Please sign in to comment.