fix(admin-chat-character): JP 리전 캐릭터 등록 성별 값을 일본어로 변환한다

This commit is contained in:
2026-03-16 11:17:03 +09:00
parent 7251939107
commit 02196eba4c
3 changed files with 100 additions and 1 deletions

View File

@@ -0,0 +1,63 @@
package kr.co.vividnext.sodalive.admin.chat.character
import kr.co.vividnext.sodalive.admin.chat.character.service.AdminChatCharacterService
import kr.co.vividnext.sodalive.admin.chat.original.service.AdminOriginalWorkService
import kr.co.vividnext.sodalive.aws.s3.S3Uploader
import kr.co.vividnext.sodalive.chat.character.service.ChatCharacterService
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import org.mockito.Mockito
import org.springframework.context.ApplicationEventPublisher
class AdminChatCharacterControllerTest {
private val controller = AdminChatCharacterController(
service = Mockito.mock(ChatCharacterService::class.java),
adminService = Mockito.mock(AdminChatCharacterService::class.java),
s3Uploader = Mockito.mock(S3Uploader::class.java),
originalWorkService = Mockito.mock(AdminOriginalWorkService::class.java),
applicationEventPublisher = Mockito.mock(ApplicationEventPublisher::class.java),
apiKey = "test-api-key",
apiUrl = "https://example.com",
s3Bucket = "test-bucket",
imageHost = "https://cdn.example.com"
)
private fun mapGender(region: String, gender: String): String {
val method = AdminChatCharacterController::class.java.getDeclaredMethod(
"mapGenderForExternalApi",
String::class.java,
String::class.java
)
method.isAccessible = true
return method.invoke(controller, region, gender) as String
}
@Test
fun shouldMapFemaleToJapaneseWhenRegionIsJp() {
val mappedGender = mapGender(region = "JP", gender = "여성")
assertEquals("女性", mappedGender)
}
@Test
fun shouldMapMaleToJapaneseWhenRegionIsJp() {
val mappedGender = mapGender(region = "JP", gender = "남성")
assertEquals("男性", mappedGender)
}
@Test
fun shouldMapOtherToJapaneseWhenRegionIsJp() {
val mappedGender = mapGender(region = "JP", gender = "기타")
assertEquals("その他", mappedGender)
}
@Test
fun shouldKeepGenderWhenRegionIsNotJp() {
val mappedGender = mapGender(region = "KR", gender = "여성")
assertEquals("여성", mappedGender)
}
}