|
@@ -19,8 +19,8 @@ describe('test/app/extend/helper.test.js', () => {
|
|
|
group_id: { type: 'integer', required: true, allowEmpty: false, min: 4, max: 10 },
|
|
|
password: { type: 'password', required: true, allowEmpty: false, min: 4 },
|
|
|
confirm_password: { type: 'password', required: true, allowEmpty: false, min: 4, compare: 'password' },
|
|
|
- ip: 'isIP',
|
|
|
- telephone: 'isMobile',
|
|
|
+ ip: { type: 'ip', allowEmpty: false },
|
|
|
+ telephone: { type: 'mobile', allowEmpty: false },
|
|
|
};
|
|
|
// 转换为json验证
|
|
|
let convertRule = ctx.helper.validateConvert(rule);
|
|
@@ -30,8 +30,8 @@ describe('test/app/extend/helper.test.js', () => {
|
|
|
group_id: { required: true, min: 4, max: 10 },
|
|
|
password: { required: true, minlength: 4 },
|
|
|
confirm_password: { required: true, minlength: 4, equalTo: '#password' },
|
|
|
- ip: 'isIP',
|
|
|
- telephone: 'isMobile',
|
|
|
+ ip: { type: 'ip', allowEmpty: false },
|
|
|
+ telephone: { type: 'mobile', allowEmpty: false },
|
|
|
};
|
|
|
expectRule = JSON.stringify(expectRule);
|
|
|
assert(convertRule === expectRule);
|