From c03c294074a30c0c8e289afbee76a9d8acee0ec3 Mon Sep 17 00:00:00 2001 From: gs97ahn Date: Sat, 6 Jan 2024 22:38:49 +0900 Subject: [PATCH] [TEST] add update profile API when portfolio name less than 1 --- .../profile/ProfileControllerTest.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/test/java/com/gabojait/gabojaitspring/api/controller/profile/ProfileControllerTest.java b/src/test/java/com/gabojait/gabojaitspring/api/controller/profile/ProfileControllerTest.java index 1fc0dacc..319c3fb8 100644 --- a/src/test/java/com/gabojait/gabojaitspring/api/controller/profile/ProfileControllerTest.java +++ b/src/test/java/com/gabojait/gabojaitspring/api/controller/profile/ProfileControllerTest.java @@ -435,6 +435,29 @@ void givenBlankEducationIsCurrent_whenUpdateProfile_thenReturn400() throws Excep .value(IS_CURRENT_FIELD_REQUIRED.getMessage())); } + @Test + @DisplayName("포트폴리오에 포트폴리오명 1자 미만일시 프로필 업데이트를 하면 400을 반환한다.") + void givenLessThan1PortfolioPortfolioName_whenUpdateProfile_thenReturn400() throws Exception { + // given + ProfileUpdateRequest request = createValidProfileUpdateRequest(); + request.getPortfolios().get(0).setPortfolioName(""); + + // when + ResultActions actions = mockMvc.perform( + post("/api/v1/user/profile") + .content(objectMapper.writeValueAsString(request)) + .contentType(APPLICATION_JSON) + ); + + // then + actions.andDo(print()) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.responseCode") + .value(PORTFOLIO_NAME_LENGTH_INVALID.name())) + .andExpect(jsonPath("$.responseMessage") + .value(PORTFOLIO_NAME_LENGTH_INVALID.getMessage())); + } + @Test @DisplayName("파일 포트폴리오를 하면 200을 반환한다.") void givenValid_whenUploadPortfolioFile_thenReturn200() throws Exception {