Change-Id: If04aa117b9aea1eb024f065d047638e3f113a48fchanges/45/24445/4
parent
399de962c5
commit
9d06ca52e5
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
export function userInfo (value) {
|
||||||
|
var regex = new RegExp(/^[-_.!~*'&=+$,;?/%a-zA-Z0-9]+$/);
|
||||||
|
return regex.test(value);
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import { assert } from 'chai';
|
||||||
|
import { userInfo } from '../../src/helpers/validation'
|
||||||
|
|
||||||
|
describe('Userinfo validation helper', function() {
|
||||||
|
|
||||||
|
it('should validate userinfo consisting of phone number and country code', function() {
|
||||||
|
let input = "+439988776655";
|
||||||
|
assert.isTrue(userInfo(input));
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should validate userinfo with parameter', function() {
|
||||||
|
let input = "+358-555-1234567;postd=pp22";
|
||||||
|
assert.isTrue(userInfo(input));
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should validate userinfo consisting of subscriber username', function() {
|
||||||
|
let input = "alice";
|
||||||
|
assert.isTrue(userInfo(input));
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not validate invalid userinfo characters', function() {
|
||||||
|
let input = "al)<e";
|
||||||
|
assert.isFalse(userInfo(input));
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in new issue