feat(gift): 선물 받을 주소 관리자 API를 추가한다
This commit is contained in:
+48
@@ -59,6 +59,54 @@ class AdminGiftControllerTest @Autowired constructor(
|
||||
categoryRepository.deleteAll()
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("관리자는 받을 주소를 조회하고 저장한다")
|
||||
fun shouldManageGiftMailbox() {
|
||||
mockMvc.perform(get("/api/v2/admin/gift-mailbox").with(user("admin").roles("ADMIN")))
|
||||
.andExpect(status().isOk)
|
||||
.andExpect(jsonPath("$.success").value(true))
|
||||
.andExpect(jsonPath("$.data").isEmpty)
|
||||
|
||||
mockMvc.perform(
|
||||
put("/api/v2/admin/gift-mailbox")
|
||||
.with(user("admin").roles("ADMIN"))
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(
|
||||
"""
|
||||
{
|
||||
"name":"소다라이브 선물 담당자",
|
||||
"phoneNumber":"01012345678",
|
||||
"zipCode":"06234",
|
||||
"address":"서울시 강남구",
|
||||
"addressDetail":"3층 선물 접수처"
|
||||
}
|
||||
""".trimIndent()
|
||||
)
|
||||
)
|
||||
.andExpect(status().isOk)
|
||||
.andExpect(jsonPath("$.success").value(true))
|
||||
.andExpect(jsonPath("$.data.name").value("소다라이브 선물 담당자"))
|
||||
.andExpect(jsonPath("$.data.phoneNumber").value("01012345678"))
|
||||
.andExpect(jsonPath("$.data.address").value("(06234) 서울시 강남구, 3층 선물 접수처"))
|
||||
|
||||
mockMvc.perform(get("/api/v2/admin/gift-mailbox").with(user("admin").roles("ADMIN")))
|
||||
.andExpect(status().isOk)
|
||||
.andExpect(jsonPath("$.data.name").value("소다라이브 선물 담당자"))
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("관리자는 공백 받을 주소를 저장할 수 없다")
|
||||
fun shouldRejectInvalidGiftMailbox() {
|
||||
mockMvc.perform(
|
||||
put("/api/v2/admin/gift-mailbox")
|
||||
.with(user("admin").roles("ADMIN"))
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content("""{"name":" ","phoneNumber":"01012345678","zipCode":"06234","address":"서울시 강남구"}""")
|
||||
)
|
||||
.andExpect(status().isOk)
|
||||
.andExpect(jsonPath("$.success").value(false))
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("관리자는 전체 선물함 목록을 필터링해 조회한다")
|
||||
fun shouldListAdminGifts() {
|
||||
|
||||
Reference in New Issue
Block a user