Skip to content

Commit

Permalink
[TEST] add more to cover update profile API
Browse files Browse the repository at this point in the history
  • Loading branch information
nogamsung committed Jan 17, 2024
1 parent bfef6b4 commit 0584b2a
Showing 1 changed file with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,29 @@ void givenPortfolioLessThan1SizePortfolioUrl_whenUpdateProfile_thenReturn400() t
.value(PORTFOLIO_URL_LENGTH_INVALID.getMessage()));
}

@Test
@DisplayName("포트폴리오에 포트폴리오 URL이 1000자 초과일시 프로필 업데이트를 하면 400을 반환한다.")
void givenPortfolioGreaterThan1000SizePortfolioUrl_whenUpdateProfile_thenReturn400() throws Exception {
// given
ProfileUpdateRequest request = createValidProfileUpdateRequest();
request.getPortfolios().get(0).setPortfolioUrl("a".repeat(1001));

// 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_URL_LENGTH_INVALID.name()))
.andExpect(jsonPath("$.responseMessage")
.value(PORTFOLIO_URL_LENGTH_INVALID.getMessage()));
}

@Test
@DisplayName("포트폴리오에 잘못된 미디어 입력시 프로필 업데이트를 하면 400을 반환한다.")
void givenPortfolioFormatMedia_whenUpdateProfile_thenReturn400() throws Exception {
Expand All @@ -528,11 +551,11 @@ void givenPortfolioFormatMedia_whenUpdateProfile_thenReturn400() throws Exceptio
}

@Test
@DisplayName("포트폴리오에 포트폴리오 URL이 1000자 초과일시 프로필 업데이트를 하면 400을 반환한다.")
void givenPortfolioGreaterThan1000SizePortfolioUrl_whenUpdateProfile_thenReturn400() throws Exception {
@DisplayName("경력에 기관명이 1자 미만일시 프로필 업데이트를 하면 400을 반환한다.")
void givenWorkLessThan1SizeCorporationName_whenUpdateProfile_thenReturn400() throws Exception {
// given
ProfileUpdateRequest request = createValidProfileUpdateRequest();
request.getPortfolios().get(0).setPortfolioUrl("a".repeat(1001));
request.getWorks().get(0).setCorporationName("");

// when
ResultActions actions = mockMvc.perform(
Expand All @@ -545,9 +568,9 @@ void givenPortfolioGreaterThan1000SizePortfolioUrl_whenUpdateProfile_thenReturn4
actions.andDo(print())
.andExpect(status().isBadRequest())
.andExpect(jsonPath("$.responseCode")
.value(PORTFOLIO_URL_LENGTH_INVALID.name()))
.value(CORPORATION_NAME_LENGTH_INVALID.name()))
.andExpect(jsonPath("$.responseMessage")
.value(PORTFOLIO_URL_LENGTH_INVALID.getMessage()));
.value(CORPORATION_NAME_LENGTH_INVALID.getMessage()));
}

@Test
Expand Down

0 comments on commit 0584b2a

Please sign in to comment.