add service
Some checks failed
Deploy Smart Search Backend / deploy (push) Failing after 13m51s

This commit is contained in:
vallyenfail
2026-01-20 22:30:05 +03:00
parent 8b9554720d
commit 9b4b8bd012
16 changed files with 103 additions and 100 deletions

View File

@@ -83,7 +83,7 @@ func ValidatePassword(password string) error {
func ValidatePhone(phone string) error {
if phone == "" {
return errors.NewBusinessError(errors.ValidationInvalidPhone, "phone is required")
return nil
}
if len(phone) > MaxPhoneLength {

View File

@@ -87,7 +87,7 @@ func TestValidatePhone(t *testing.T) {
{"valid international", "+1234567890", false, ""},
{"valid with country code", "+79123456789", false, ""},
{"valid without plus", "1234567890", false, ""},
{"empty", "", true, errors.ValidationInvalidPhone},
{"empty is valid", "", false, ""},
{"too short", "123", true, errors.ValidationInvalidPhone},
{"letters", "abcdefgh", true, errors.ValidationInvalidPhone},
{"too long", "+123456789012345678901", true, errors.ValidationInvalidPhone},
@@ -203,6 +203,7 @@ func TestValidateRegistration(t *testing.T) {
wantErr bool
}{
{"valid", "test@example.com", "Abcd1234", "John Doe", "+1234567890", false},
{"valid without phone", "test@example.com", "Abcd1234", "John Doe", "", false},
{"invalid email", "invalid", "Abcd1234", "John Doe", "+1234567890", true},
{"invalid password", "test@example.com", "weak", "John Doe", "+1234567890", true},
{"invalid name", "test@example.com", "Abcd1234", "", "+1234567890", true},