UNPKG

libphonenumber-metadata-generator

Version:

Metadata generator for `libphonenumber-js`

51 lines (49 loc) 5.72 kB
import { describe, it } from 'mocha'; import { expect } from 'chai'; import parseReleaseNotes from './parseReleaseNotes.js'; describe('parseReleaseNotes', function () { it('should parse release notes', function () { expect(parseReleaseNotes("Jan 13, 2025: v8.13.53\nCode changes:\n - Fixed a bug where the extension was appended twice in formatOutOfCountryKeepingAlphaChars in the Java version and updated FormatOutOfCountryKeepingAlphaChars in the C++ version to format the extension.\nMetadata changes:\n - Updated phone metadata for region code(s):\n EH, IL, LV, MA, MK, MM, MU, PW, SO\n - Updated carrier data for country calling code(s):\n 90 (en), 92 (en), 212 (en), 229 (en), 252 (en), 351 (en), 371 (en), 389 (en),\n 597 (en), 680 (en)\n - Updated / refreshed time zone meta data.")).to.deep.equal([{ date: new Date(Date.UTC(2025, 0, 13)), version: '8.13.53', changes: ['Updated phone metadata for region code(s):\nEH, IL, LV, MA, MK, MM, MU, PW, SO', 'Updated carrier data for country calling code(s):\n90 (en), 92 (en), 212 (en), 229 (en), 252 (en), 351 (en), 371 (en), 389 (en),\n597 (en), 680 (en)', 'Updated / refreshed time zone meta data.'] }]); }); it('should parse release notes (no metadata changes)', function () { expect(parseReleaseNotes("Jan 13, 2025: v8.13.53\nCode changes:\n - Fixed a bug where the extension was appended twice in formatOutOfCountryKeepingAlphaChars in the Java version and updated FormatOutOfCountryKeepingAlphaChars in the C++ version to format the extension.")).to.deep.equal([{ date: new Date(Date.UTC(2025, 0, 13)), version: '8.13.53', changes: [] }]); }); it('should parse release notes (multiple releases)', function () { expect(parseReleaseNotes("Feb 13, 2025: v8.13.55\nMetadata changes:\n - Updated phone metadata for region code(s): BE, CZ, SR\n - Updated short number metadata for region code(s): NO\n - Updated carrier data for country calling code(s):\n 33 (en), 41 (en), 255 (en), 351 (en), 503 (en), 597 (en)\n\nJan 29, 2025: v8.13.54\nMetadata changes:\n - Updated phone metadata for region code(s): HK, ML, NC, PL, US\n - New geocoding data for country calling code(s): 1274 (en)\n - Updated carrier data for country calling code(s):\n 41 (en), 48 (en), 51 (en), 223 (en), 268 (en), 852 (en, zh)\n - Updated / refreshed time zone meta data.\n\nAugust 11th, 2011: libphonenumber-3.8\n* Code changes\n - Fix to demo to not throw null-ptr exceptions for invalid NANPA numbers\n - Fixed AYTF to not accept plus signs in the middle of input\n - PhoneNumberMatcher improvements - added STRICT_GROUPING and EXACT_GROUPING levels, numbers\n followed/preceded by a currency symbol will not match, multiple numbers separated by phone-number\n punctuation will now match. \", \" is no longer accepted as an extension symbol when matching, only\n when parsing. \"x\" is only accepted as a carrier code or extension marker, not otherwise.\n - Changes to handling of leading zeroes - these will not be silently ignored anymore, but will be\n stored as part of the number.\n - PhoneNumberOfflineGeocoder - new method to get the description of a number that assumes the\n validity of the number has already been checked and will not re-verify it.\n - Split geocoding US binary data into multiple files.\n\nJuly 30th, 2010\n* Metadata change:\n - new country: TL\n - update to existing country: AZ, CN, FR, GH, JO, LA, PG, PK, QA, SZ, UA, VN\n\n* Code improvement\n - China local number formatting for AsYouTypeFormatter\n - improve extension parsing to handle number in the form of +1 (645) 123 1234 ext. 910#")).to.deep.equal([{ date: new Date(Date.UTC(2025, 1, 13)), version: '8.13.55', changes: ['Updated phone metadata for region code(s): BE, CZ, SR', 'Updated short number metadata for region code(s): NO', 'Updated carrier data for country calling code(s):\n33 (en), 41 (en), 255 (en), 351 (en), 503 (en), 597 (en)'] }, { date: new Date(Date.UTC(2025, 0, 29)), version: '8.13.54', changes: ['Updated phone metadata for region code(s): HK, ML, NC, PL, US', 'New geocoding data for country calling code(s): 1274 (en)', 'Updated carrier data for country calling code(s):\n41 (en), 48 (en), 51 (en), 223 (en), 268 (en), 852 (en, zh)', 'Updated / refreshed time zone meta data.'] }, { date: new Date(Date.UTC(2011, 7, 11)), version: '3.8', changes: [] // changes: [ // 'Fix to demo to not throw null-ptr exceptions for invalid NANPA numbers', // 'Fixed AYTF to not accept plus signs in the middle of input', // 'PhoneNumberMatcher improvements - added STRICT_GROUPING and EXACT_GROUPING levels, numbers\nfollowed/preceded by a currency symbol will not match, multiple numbers separated by phone-number\npunctuation will now match. ", " is no longer accepted as an extension symbol when matching, only\nwhen parsing. "x" is only accepted as a carrier code or extension marker, not otherwise.', // 'Changes to handling of leading zeroes - these will not be silently ignored anymore, but will be\nstored as part of the number.', // 'PhoneNumberOfflineGeocoder - new method to get the description of a number that assumes the\nvalidity of the number has already been checked and will not re-verify it.', // 'Split geocoding US binary data into multiple files.' // ] }, { date: new Date(Date.UTC(2010, 6, 30)), version: undefined, changes: [] // changes: [ // 'new country: TL', // 'update to existing country: AZ, CN, FR, GH, JO, LA, PG, PK, QA, SZ, UA, VN' // ] }]); }); }); //# sourceMappingURL=parseReleaseNotes.test.js.map