diff --git a/src/test/java/com/project/mapdagu/domain/auth/controller/AuthControllerTest.java b/src/test/java/com/project/mapdagu/domain/auth/controller/AuthControllerTest.java index 7f6b42e..d616860 100644 --- a/src/test/java/com/project/mapdagu/domain/auth/controller/AuthControllerTest.java +++ b/src/test/java/com/project/mapdagu/domain/auth/controller/AuthControllerTest.java @@ -1,7 +1,9 @@ package com.project.mapdagu.domain.auth.controller; import com.fasterxml.jackson.databind.ObjectMapper; +import com.project.mapdagu.domain.auth.dto.request.RefreshTokenRequest; import com.project.mapdagu.domain.auth.service.AuthService; +import com.project.mapdagu.jwt.service.JwtService; import com.project.mapdagu.utils.TestUserArgumentResolver; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -29,6 +31,8 @@ class AuthControllerTest { private AuthController authController; @Mock private AuthService authService; + @Mock + private JwtService jwtService; private ObjectMapper objectMapper = new ObjectMapper(); private MockMvc mockMvc; @@ -51,4 +55,19 @@ void setUp() { result.andExpect(status().isNoContent()); verify(authService, times(1)).logout(any(), anyString()); } + + @Test + void 토큰_재발급() throws Exception { + //given + RefreshTokenRequest request = new RefreshTokenRequest("refreshToken"); + //when + ResultActions result = mockMvc.perform( + post("/auth/reIssue") + .contentType(MediaType.APPLICATION_JSON) + .content(objectMapper.writeValueAsString(request)) + ); + //then + result.andExpect(status().isNoContent()); + verify(jwtService, times(1)).reIssueToken(any(), anyString()); + } } \ No newline at end of file