From 1985ce4af21ecded222ff824dcd1d0ae093bbb47 Mon Sep 17 00:00:00 2001 From: soutoukakka Date: Thu, 28 Feb 2019 18:30:22 +0800 Subject: [PATCH] Update Canada phone number --- __tests__/index.js | 18 ++++++++++++++++++ lib/iso3166Data.js | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/__tests__/index.js b/__tests__/index.js index 559c49d..3dc00a3 100644 --- a/__tests__/index.js +++ b/__tests__/index.js @@ -1092,6 +1092,24 @@ describe( 'Testing MMR Phone', () => { }); +describe( 'Testing Canada Phone', () => { + describe('Should return result when it match begin with', () => { + const number = '+1 367 1234567'; + const result = ['+13671234567', 'CAN']; + test('returns ' + result, () => { + expect(phone(number)).toEqual(result); + }); + }); + describe('Should not return result when it match begin with', () => { + const number = '+1 111 1234567'; + const result = []; + test('returns ' + result, () => { + expect(phone(number)).toEqual(result); + }); + }); +}); + + describe('test phone with trunk prefix', () => { test('Austrilia phone with trunk prefix (0)', () => { const number = '+61(0)488888888'; diff --git a/lib/iso3166Data.js b/lib/iso3166Data.js index 26fc986..697e48c 100644 --- a/lib/iso3166Data.js +++ b/lib/iso3166Data.js @@ -324,7 +324,7 @@ module.exports = [ alpha3: 'CAN', country_code: '1', country_name: 'Canada', - mobile_begin_with: ['204', '226', '236', '249', '250', '289', '306', '343', '365', '403', '416', '418', '431', + mobile_begin_with: ['204', '226', '236', '249', '250', '289', '306', '343', '365', '367', '403', '416', '418', '431', '437', '438', '450', '506', '514', '519', '579', '581', '587', '600', '604', '613', '639', '647', '705', '709', '778', '780', '807', '819', '867', '873', '902', '905'], phone_number_lengths: [10]