extractCountryCallingCode.test.js 749 B

1234567891011121314151617181920
  1. import extractCountryCallingCode from './extractCountryCallingCode.js'
  2. import metadata from '../../metadata.min.json' assert { type: 'json' }
  3. describe('extractCountryCallingCode', () => {
  4. it('should extract country calling code from a number', () => {
  5. extractCountryCallingCode('+78005553535', null, null, metadata).should.deep.equal({
  6. countryCallingCodeSource: 'FROM_NUMBER_WITH_PLUS_SIGN',
  7. countryCallingCode: '7',
  8. number: '8005553535'
  9. })
  10. extractCountryCallingCode('+7800', null, null, metadata).should.deep.equal({
  11. countryCallingCodeSource: 'FROM_NUMBER_WITH_PLUS_SIGN',
  12. countryCallingCode: '7',
  13. number: '800'
  14. })
  15. extractCountryCallingCode('', null, null, metadata).should.deep.equal({})
  16. })
  17. })