Skip to content

Commit

Permalink
test: 테스트 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
GGHDMS committed Dec 17, 2023
1 parent 0c7388e commit 948240f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 129 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
package com.yourssu.ssudateserver.controller

import com.yourssu.ssudateserver.common.BaseTest
import com.yourssu.ssudateserver.dto.request.UpdateMaleRequestDto
import com.yourssu.ssudateserver.dto.request.UpdateRequestDto
import com.yourssu.ssudateserver.enums.MBTI
import com.yourssu.ssudateserver.enums.MaleAnimals
import com.yourssu.ssudateserver.fixture.PrincipalFixture.Companion.setPrincipal
import org.junit.jupiter.api.Test
import org.springframework.http.MediaType
import org.springframework.test.context.ActiveProfiles
import org.springframework.test.web.servlet.patch

@ActiveProfiles("test")
class UpdateMaleTest : BaseTest() {
class UpdateUserInfoTest : BaseTest() {

@Test
fun updateMaleTest() {
setPrincipal()

val requestDto = UpdateMaleRequestDto(
animals = MaleAnimals.WOLF,
val requestDto = UpdateRequestDto(
nickName = "NICKNICK",
mbti = MBTI.INFP,
introduce = "hihihi",
contact = "01012345678",
)

val test = mockMvc.patch("/users/my/male") {
val test = mockMvc.patch("/users/my") {
contentType = MediaType.APPLICATION_JSON
content = objectMapper.writeValueAsString(requestDto)
}

test.andExpect {
status { isOk() }
jsonPath("id") { exists() }
jsonPath("animals") { value("WOLF") }
jsonPath("animals") { value("PUSSUNG") }
jsonPath("nickName") { value("NICKNICK") }
jsonPath("mbti") { value("INFP") }
jsonPath("introduce") { value("hihihi") }
Expand All @@ -45,41 +43,16 @@ class UpdateMaleTest : BaseTest() {
}
}

@Test
fun updateMaleTestFailAnimalsAll() {
setPrincipal()
val requestDto = UpdateMaleRequestDto(
animals = MaleAnimals.ALL,
nickName = "NICKNICK",
mbti = MBTI.INFP,
introduce = "hihihi",
contact = "01012345678",
)
val test = mockMvc.patch("/users/my/male") {
contentType = MediaType.APPLICATION_JSON
content = objectMapper.writeValueAsString(requestDto)
}

test.andExpect {
status { isBadRequest() }
jsonPath("message") { value("ALL은 등록불가능 합니다.") }
}
test.andDo {
print()
}
}

@Test
fun updateMaleTestFailNickNameDuplicate() {
setPrincipal()
val requestDto = UpdateMaleRequestDto(
animals = MaleAnimals.BEAR,
val requestDto = UpdateRequestDto(
nickName = "testNick2",
mbti = MBTI.INFP,
introduce = "hihihi",
contact = "01012345678",
)
val test = mockMvc.patch("/users/my/male") {
val test = mockMvc.patch("/users/my") {
contentType = MediaType.APPLICATION_JSON
content = objectMapper.writeValueAsString(requestDto)
}
Expand Down

0 comments on commit 948240f

Please sign in to comment.