diff --git a/phone/number.go b/phone/number.go index 4c0d393..a2657cd 100644 --- a/phone/number.go +++ b/phone/number.go @@ -33,8 +33,8 @@ func (number Number) Validate() error { return fmt.Errorf("'%s' is not valid phone number", number) } - // minimum length is 7 for Saint Helena (Format: +290 XXXX) and Niue (Format: +683 XXXX) - if len(number) < 7 || len(number) > 15 { + // minimum length is 5 for Saint Helena (Format: +290 XXXXX) + if len(number) < 5 || len(number) > 15 { return fmt.Errorf("'%s' is not valid phone number", number) } diff --git a/phone/number_test.go b/phone/number_test.go index 7c96e9a..5d4379b 100644 --- a/phone/number_test.go +++ b/phone/number_test.go @@ -15,7 +15,7 @@ var testNumberCases = []struct { }{ {testValue: "", expectingValidateError: true, expectingValueError: false, expectingUnmarshalError: false}, {testValue: "123", expectingValidateError: true, expectingValueError: true, expectingUnmarshalError: true}, - {testValue: "123456", expectingValidateError: true, expectingValueError: true, expectingUnmarshalError: true}, + {testValue: "12345", expectingValidateError: false, expectingValueError: false, expectingUnmarshalError: false}, {testValue: "1234", expectingValidateError: true, expectingValueError: true, expectingUnmarshalError: true}, {testValue: "1234567", expectingValidateError: false, expectingValueError: false, expectingUnmarshalError: false}, {testValue: "1234567890", expectingValidateError: false, expectingValueError: false, expectingUnmarshalError: false},