getExampleNumber.test.js 685 B

1234567891011121314151617
  1. import examples from '../examples.mobile.json' assert { type: 'json' }
  2. import metadata from '../metadata.min.json' assert { type: 'json' }
  3. import getExampleNumber from './getExampleNumber.js'
  4. describe('getExampleNumber', () => {
  5. it('should get an example number', () => {
  6. const phoneNumber = getExampleNumber('RU', examples, metadata)
  7. phoneNumber.nationalNumber.should.equal('9123456789')
  8. phoneNumber.number.should.equal('+79123456789')
  9. phoneNumber.countryCallingCode.should.equal('7')
  10. phoneNumber.country.should.equal('RU')
  11. })
  12. it('should handle a non-existing country', () => {
  13. expect(getExampleNumber('XX', examples, metadata)).to.be.undefined
  14. })
  15. })