Skip to content

Commit

Permalink
phone number type lower bound change (#41)
Browse files Browse the repository at this point in the history
* data source links applied, type renaming

* phone parser

* unmarshalling empty value fix

* empty value unmarshalling fix

* ipv6 implementation

* ip dual stack implementation

* phone number type lower bound change

---------

Co-authored-by: ivan-lemiashonak <[email protected]>
  • Loading branch information
ilemiashonak and ilemiashonak authored Mar 7, 2024
1 parent 48b6bc9 commit fb2f020
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions phone/number.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion phone/number_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit fb2f020

Please sign in to comment.