fix(gift): 수령인 이름 검증을 보정한다
This commit is contained in:
@@ -21,7 +21,7 @@ data class GiftRecipientAddressFormState(
|
|||||||
val recipientPrivacyAgreed: Boolean = false
|
val recipientPrivacyAgreed: Boolean = false
|
||||||
) {
|
) {
|
||||||
val isSubmitEnabled: Boolean
|
val isSubmitEnabled: Boolean
|
||||||
get() = recipientName.isNotBlank() &&
|
get() = GiftSendInputFilters.isValidName(recipientName) &&
|
||||||
recipientPhoneNumber.isNotBlank() &&
|
recipientPhoneNumber.isNotBlank() &&
|
||||||
recipientZipCode.isNotBlank() &&
|
recipientZipCode.isNotBlank() &&
|
||||||
recipientAddress.isNotBlank() &&
|
recipientAddress.isNotBlank() &&
|
||||||
|
|||||||
+11
@@ -70,6 +70,17 @@ class GiftRecipientAddressViewModelTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `완성되지 않은 한글이나 숫자 또는 13자 이름은 제출하지 않는다`() {
|
||||||
|
listOf("ㄱ", "이름1", "가".repeat(13)).forEach { name ->
|
||||||
|
viewModel.updateForm(validForm().copy(recipientName = name))
|
||||||
|
|
||||||
|
assertFalse(viewModel.formState.value!!.isSubmitEnabled)
|
||||||
|
viewModel.submit("test-gift")
|
||||||
|
assertTrue(api.requests.isEmpty())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `공백 신청번호는 유효한 form이어도 POST하지 않는다`() {
|
fun `공백 신청번호는 유효한 form이어도 POST하지 않는다`() {
|
||||||
viewModel.updateForm(validForm())
|
viewModel.updateForm(validForm())
|
||||||
|
|||||||
Reference in New Issue
Block a user