Skip to content

Commit

Permalink
fix TestGetExampleNumberForNonGeoEntity
Browse files Browse the repository at this point in the history
Signed-off-by: Alexjander Bacalso <[email protected]>
  • Loading branch information
XanderDwyl committed Nov 13, 2018
1 parent 89a624d commit 93fd1e9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
7 changes: 6 additions & 1 deletion phonenumberutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -1960,7 +1960,12 @@ func GetExampleNumberForNonGeoEntity(countryCallingCode int) *PhoneNumber {
if metadata == nil {
return nil
}
var desc *PhoneNumberDesc = metadata.GetGeneralDesc()
var desc *PhoneNumberDesc = metadata.GetTollFree()

if countryCallingCode == 979 {
desc = metadata.GetPremiumRate()
}

exNum := desc.GetExampleNumber()
if len(exNum) > 0 {
num, err := Parse("+"+strconv.Itoa(countryCallingCode)+exNum, "ZZ")
Expand Down
24 changes: 12 additions & 12 deletions phonenumberutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -695,18 +695,18 @@ func Test_GetExampleNumberForType(t *testing.T) {
}
}

// func TestGetExampleNumberForNonGeoEntity(t *testing.T) {
// if !reflect.DeepEqual(
// getTestNumber("INTERNATIONAL_TOLL_FREE"),
// GetExampleNumberForNonGeoEntity(800)) {
// t.Error("there should be an example 800 number")
// }
// if !reflect.DeepEqual(
// getTestNumber("UNIVERSAL_PREMIUM_RATE"),
// GetExampleNumberForNonGeoEntity(979)) {
// t.Error("there should be an example number for 979")
// }
// }
func TestGetExampleNumberForNonGeoEntity(t *testing.T) {
if !reflect.DeepEqual(
getTestNumber("INTERNATIONAL_TOLL_FREE"),
GetExampleNumberForNonGeoEntity(800)) {
t.Error("there should be an example 800 number")
}
if !reflect.DeepEqual(
getTestNumber("UNIVERSAL_PREMIUM_RATE"),
GetExampleNumberForNonGeoEntity(979)) {
t.Error("there should be an example number for 979")
}
}

func TestNormalizeDigitsOnly(t *testing.T) {
if "03456234" != NormalizeDigitsOnly("034-56&+a#234") {
Expand Down

0 comments on commit 93fd1e9

Please sign in to comment.