Skip to content

Commit

Permalink
test: 회원 정보 수정 요청 시 비밀번호와 비밀번호 확인이 일치하지 않는 경우에 대한 테스트 코드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeuk520 committed Sep 30, 2024
1 parent b5e659e commit 579e366
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ku.covigator.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ku.covigator.dto.request.PatchMemberRequest;
import com.ku.covigator.dto.request.PostVerifyNicknameRequest;
Expand Down Expand Up @@ -33,7 +34,6 @@ class MemberControllerTest {
@Test
void updateMemberInfo() throws Exception {
//given

PatchMemberRequest request = PatchMemberRequest.builder()
.nickname("covi")
.password("covigator123!")
Expand All @@ -48,6 +48,24 @@ void updateMemberInfo() throws Exception {
.andExpect(status().isOk());
}

@DisplayName("비밀번호와 비밀번호 확인이 일치하지 않는 경우 상태코드 400을 반환한다.")
@Test
void return400WhenPasswordIsNotEqualToPasswordVerification() throws Exception {
//given
PatchMemberRequest request = PatchMemberRequest.builder()
.nickname("covi")
.password("covigator123!")
.passwordVerification("covi123!")
.build();

//when //then
mockMvc.perform(patch("/members/{member_id}", 1L)
.content(objectMapper.writeValueAsString(request))
.contentType(MediaType.APPLICATION_JSON)
).andDo(print())
.andExpect(status().isBadRequest());
}

@DisplayName("닉네임 중복 확인을 요청한다.")
@Test
void verifyNicknameDuplication() throws Exception {
Expand Down

0 comments on commit 579e366

Please sign in to comment.