UNPKG

libphonenumber-js

Version:

A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript

27 lines (23 loc) 680 B
import { describe, it } from 'mocha' import { expect } from 'chai' import getNumberType from './getNumberType.js' import oldMetadata from '../../test/metadata/1.0.0/metadata.min.json' with { type: 'json' } describe('getNumberType', function() { it('should get number type when using old metadata', function() { expect(getNumberType( { nationalNumber: '2133734253', country: 'US' }, { v2: true }, oldMetadata )).to.equal('FIXED_LINE_OR_MOBILE') }) it('should return `undefined` when the phone number is a malformed one', function() { expect(getNumberType( {}, { v2: true }, oldMetadata )).to.be.undefined }) })