formatIncompletePhoneNumber.test.js 1.1 KB

123456789101112131415161718192021222324
  1. import formatIncompletePhoneNumber from './formatIncompletePhoneNumber.js';
  2. import metadata from '../metadata.min.json' assert { type: 'json' };
  3. describe('formatIncompletePhoneNumber', function () {
  4. it('should format parsed input value', function () {
  5. var result; // National input.
  6. formatIncompletePhoneNumber('880055535', 'RU', metadata).should.equal('8 (800) 555-35'); // International input, no country.
  7. formatIncompletePhoneNumber('+780055535', null, metadata).should.equal('+7 800 555 35'); // International input, no country argument.
  8. formatIncompletePhoneNumber('+780055535', metadata).should.equal('+7 800 555 35'); // International input, with country.
  9. formatIncompletePhoneNumber('+780055535', 'RU', metadata).should.equal('+7 800 555 35');
  10. });
  11. it('should support an object argument', function () {
  12. formatIncompletePhoneNumber('880055535', {
  13. defaultCountry: 'RU'
  14. }, metadata).should.equal('8 (800) 555-35');
  15. formatIncompletePhoneNumber('880055535', {
  16. defaultCallingCode: '7'
  17. }, metadata).should.equal('8 (800) 555-35');
  18. });
  19. });
  20. //# sourceMappingURL=formatIncompletePhoneNumber.test.js.map