style: removed extra logging in unit tests and replace tel regexp

This commit is contained in:
Dmitry Nagibin
2020-07-30 11:00:10 +03:00
parent e5875333bc
commit 9e8b94f9cf
3 changed files with 2 additions and 8 deletions
@@ -332,7 +332,6 @@ describe('/src/ncform-utils.js', () => {
}
};
ncformUtils.setValueToSchema(value, formSchema);
console.log(formSchema);
assert(formSchema.properties.name.value === value.name);
});
it("setValueToSchema - nested object", () => {
@@ -355,7 +354,6 @@ describe('/src/ncform-utils.js', () => {
}
};
ncformUtils.setValueToSchema(value, formSchema);
console.log(JSON.stringify(formSchema, null, 2));
assert(
formSchema.properties.name.properties.firstname.value ===
value.name.firstname
@@ -381,7 +379,6 @@ describe('/src/ncform-utils.js', () => {
}
};
ncformUtils.setValueToSchema(value, formSchema);
console.log(JSON.stringify(formSchema, null, 2));
assert(formSchema.properties.name.value === value.name);
});
it("setValueToSchema - nested array of objects and then objects", () => {
@@ -410,7 +407,6 @@ describe('/src/ncform-utils.js', () => {
}
};
ncformUtils.setValueToSchema(value, formSchema);
console.log(JSON.stringify(formSchema, null, 2));
assert(
JSON.stringify(formSchema.properties.user.value) ===
JSON.stringify(value.user)
@@ -425,7 +421,6 @@ describe('/src/ncform-utils.js', () => {
}
};
ncformUtils.setValueToSchema(value, formSchema);
console.log(JSON.stringify(formSchema, null, 2));
assert(formSchema.value === value);
});
it("setValueToSchema - nested array", () => {
@@ -440,7 +435,6 @@ describe('/src/ncform-utils.js', () => {
}
};
ncformUtils.setValueToSchema(value, formSchema);
console.log(JSON.stringify(formSchema, null, 2));
assert(formSchema.value === value);
});
it("setValueToSchema - non-schema object", () => {
+1 -1
View File
@@ -71,7 +71,7 @@ class RegularValidation {
if (!this.allRules[keys[i]]) {
resolve({
result: false,
errMsg: `不存在验证规则${keys[i]}`
errMsg: `No validation rule for ${keys[i]}`
});
}
+1 -1
View File
@@ -12,7 +12,7 @@ class TelRule extends ValidationRule {
validateLogic(val, ruleVal) {
if (!ruleVal) return true;
if (typeof val !== "string") return true;
return /^1[3|4|5|7|8][0-9]\d{4,8}$/.test(val);
return /\+?[1-9]?([\ \.\-]?)\(?([0-9]{3})\)?([\ \.\-]?)([0-9]{3})([\ \.\-]?)([0-9]{4})/i.test(val);
}
}