Skip to content

Commit

Permalink
updated data
Browse files Browse the repository at this point in the history
  • Loading branch information
daddyz committed Aug 27, 2019
1 parent 4d33f3c commit 2059615
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
Binary file modified data/extended_data.dat
Binary file not shown.
Binary file modified data/phone_data.dat
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/phonelib/data_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Importer
include Phonelib::DataImporterHelper

# countries that can have double country prefix in number
DOUBLE_COUNTRY_CODES_COUNTRIES = %w(IN DE BR IT NO PL CU)
DOUBLE_COUNTRY_CODES_COUNTRIES = %w(IN DE BR IT NO PL CU VN)

# main data file in repo
MAIN_FILE = 'resources/PhoneNumberMetadata.xml'
Expand Down
17 changes: 13 additions & 4 deletions spec/phonelib_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@
it 'should be valid for mexico numbers' do
number = Phonelib.parse('+5215545258448', 'mx')
expect(number.valid?).to be true
expect(number.international).to eq('+52 1 55 4525 8448')
expect(number.national).to eq('044 55 4525 8448')
expect(number.international).to eq('+52 55 4525 8448')
expect(number.national).to eq('55 4525 8448')

intl = number.international

Expand Down Expand Up @@ -941,7 +941,7 @@
it 'should simplify national prefix and make phone valid' do
phone = Phonelib.parse '0445532231113', 'MX'
expect(phone.valid?).to be true
expect(phone.international).to eq('+52 1 55 3223 1113')
expect(phone.international).to eq('+52 55 3223 1113')
expect(phone.country).to eq('MX')
end
end
Expand Down Expand Up @@ -1153,7 +1153,16 @@
context 'issue #152' do
it 'should return correct format for MX' do
p = Phonelib.parse('0459991234567', 'MX')
expect(p.national).to eq('044 999 123 4567')
expect(p.national).to eq('999 123 4567')
end
end

context 'issue #171' do
it 'should return correct format for VN' do
p = Phonelib.parse('902962207', 'VN')
expect(p.international).to eq('+84 90 296 22 07')
p = Phonelib.parse('844666531', 'VN')
expect(p.international).to eq('+84 844 666 531')
end
end

Expand Down

0 comments on commit 2059615

Please sign in to comment.