getCountryCallingCode.test.js 439 B

12345678910111213
  1. import metadata from '../metadata.min.json' assert { type: 'json' }
  2. import getCountryCallingCode from './getCountryCallingCode.js'
  3. describe('getCountryCallingCode', () => {
  4. it('should get country calling code', () => {
  5. getCountryCallingCode('US', metadata).should.equal('1')
  6. })
  7. it('should throw if country is unknown', () => {
  8. expect(() => getCountryCallingCode('ZZ', metadata)).to.throw('Unknown country: ZZ')
  9. })
  10. })