isPossibleNumber.test.js.map 3.9 KB

1
  1. {"version":3,"file":"isPossibleNumber.test.js","names":["metadata","type","_isPossibleNumber","isPossibleNumber","parameters","push","apply","describe","it","should","equal","phone","country","countryCallingCode","nationalNumber","v2","expect","to"],"sources":["../../source/legacy/isPossibleNumber.test.js"],"sourcesContent":["import metadata from '../../metadata.min.json' assert { type: 'json' }\r\nimport _isPossibleNumber from './isPossibleNumber.js'\r\n\r\nfunction isPossibleNumber(...parameters) {\r\n\tparameters.push(metadata)\r\n\treturn _isPossibleNumber.apply(this, parameters)\r\n}\r\n\r\ndescribe('isPossibleNumber', () => {\r\n\tit('should work', function()\r\n\t{\r\n\t\tisPossibleNumber('+79992223344').should.equal(true)\r\n\r\n\t\tisPossibleNumber({ phone: '1112223344', country: 'RU' }).should.equal(true)\r\n\t\tisPossibleNumber({ phone: '111222334', country: 'RU' }).should.equal(false)\r\n\t\tisPossibleNumber({ phone: '11122233445', country: 'RU' }).should.equal(false)\r\n\r\n\t\tisPossibleNumber({ phone: '1112223344', countryCallingCode: 7 }).should.equal(true)\r\n\t})\r\n\r\n\tit('should work v2', () => {\r\n\t\tisPossibleNumber({ nationalNumber: '111222334', countryCallingCode: 7 }, { v2: true }).should.equal(false)\r\n\t\tisPossibleNumber({ nationalNumber: '1112223344', countryCallingCode: 7 }, { v2: true }).should.equal(true)\r\n\t\tisPossibleNumber({ nationalNumber: '11122233445', countryCallingCode: 7 }, { v2: true }).should.equal(false)\r\n\t})\r\n\r\n\tit('should work in edge cases', () => {\r\n\t\t// Invalid `PhoneNumber` argument.\r\n\t\texpect(() => isPossibleNumber({}, { v2: true })).to.throw('Invalid phone number object passed')\r\n\r\n\t\t// Empty input is passed.\r\n\t\t// This is just to support `isValidNumber({})`\r\n\t\t// for cases when `parseNumber()` returns `{}`.\r\n\t\tisPossibleNumber({}).should.equal(false)\r\n\t\texpect(() => isPossibleNumber({ phone: '1112223344' })).to.throw('Invalid phone number object passed')\r\n\r\n\t\t// Incorrect country.\r\n\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