提交 2e42f519 编写于 作者: 雪洛's avatar 雪洛

fix: appversion code check error

上级 dcdc2b6c
...@@ -330,6 +330,10 @@ function checkClientInfo (clientInfo) { ...@@ -330,6 +330,10 @@ function checkClientInfo (clientInfo) {
required: false, required: false,
type: 'number' type: 'number'
} }
const numberOrStringNotRequired = {
required: false,
type: 'number|string'
}
const schema = { const schema = {
uniPlatform: 'string', uniPlatform: 'string',
appId: 'string', appId: 'string',
...@@ -339,11 +343,8 @@ function checkClientInfo (clientInfo) { ...@@ -339,11 +343,8 @@ function checkClientInfo (clientInfo) {
clientIP: stringNotRequired, clientIP: stringNotRequired,
appName: stringNotRequired, appName: stringNotRequired,
appVersion: stringNotRequired, appVersion: stringNotRequired,
appVersionCode: stringNotRequired, appVersionCode: numberOrStringNotRequired,
channel: { channel: numberOrStringNotRequired,
required: false,
type: 'number|string'
},
userAgent: stringNotRequired, userAgent: stringNotRequired,
uniIdToken: stringNotRequired, uniIdToken: stringNotRequired,
deviceBrand: stringNotRequired, deviceBrand: stringNotRequired,
......
...@@ -64,6 +64,93 @@ const testCaseList = [{ ...@@ -64,6 +64,93 @@ const testCaseList = [{
expected: { expected: {
errCode: ERROR.INVALID_PASSWORD errCode: ERROR.INVALID_PASSWORD
} }
}, {
value: {
numberOrString: '123456'
},
schema: {
numberOrString: 'number|string'
}
}, {
value: {
numberOrString: 123456
},
schema: {
numberOrString: 'number|string'
}
}, {
value: {
numberOrString: '123456'
},
schema: {
numberOrString: 'string|number'
}
}, {
value: {
numberOrString: 123456
},
schema: {
numberOrString: 'string|number'
}
}, {
value: {
numberOrString: ['123456']
},
schema: {
numberOrString: 'array<number|string>'
}
}, {
value: {
numberOrString: [123456]
},
schema: {
numberOrString: 'array<number|string>'
}
}, {
value: {
numberOrString: [123456, '123456']
},
schema: {
numberOrString: 'array<number|string>'
}
}, {
value: {
numberOrString: ['123456']
},
schema: {
numberOrString: 'array<string|number>'
}
}, {
value: {
numberOrString: [123456]
},
schema: {
numberOrString: 'array<string|number>'
}
}, {
value: {
numberOrString: [123456, '123456']
},
schema: {
numberOrString: 'array<string|number>'
}
}, {
value: {
numberOrString: ['123456']
},
mixin: [{
type: '1to6',
handler: function (val) {
if (val !== '123456') {
return {
errCode: ERROR.INVALID_PARAM
}
}
}
}],
schema: {
numberOrString: 'array<number|1to6>'
}
}] }]
function execTestCase ({ function execTestCase ({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册