@aws-amplify/graphql-api-construct
Version:
AppSync GraphQL Api Construct using Amplify GraphQL Transformer.
27 lines (24 loc) • 1.15 kB
JavaScript
import _isPossiblePhoneNumber from './isPossiblePhoneNumber';
import metadata from '../metadata.min.json';
function isPossiblePhoneNumber() {
for (var _len = arguments.length, parameters = new Array(_len), _key = 0; _key < _len; _key++) {
parameters[_key] = arguments[_key];
}
parameters.push(metadata);
return _isPossiblePhoneNumber.apply(this, parameters);
}
describe('isPossiblePhoneNumber', function () {
it('should detect whether a phone number is possible', function () {
isPossiblePhoneNumber('8 (800) 555 35 35', 'RU').should.equal(true);
isPossiblePhoneNumber('8 (800) 555 35 35 0', 'RU').should.equal(false);
isPossiblePhoneNumber('Call: 8 (800) 555 35 35', 'RU').should.equal(false);
isPossiblePhoneNumber('8 (800) 555 35 35', {
defaultCountry: 'RU'
}).should.equal(true);
isPossiblePhoneNumber('+7 (800) 555 35 35').should.equal(true);
isPossiblePhoneNumber('+7 1 (800) 555 35 35').should.equal(false);
isPossiblePhoneNumber(' +7 (800) 555 35 35').should.equal(false);
isPossiblePhoneNumber(' ').should.equal(false);
});
});
//# sourceMappingURL=isPossiblePhoneNumber.test.js.map