家谱现有接口调试50%
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
const assert = require('assert');
|
||||
const SecurityPages = require('../public/js/security-pages.js');
|
||||
|
||||
function hash(value) {
|
||||
return `hashed:${value}`;
|
||||
}
|
||||
|
||||
function run() {
|
||||
assert.deepStrictEqual(SecurityPages.buildPasswordChangeBody({
|
||||
oldPassword: '123456',
|
||||
newPassword: 'abcdef'
|
||||
}, hash), {
|
||||
oldPassword: 'hashed:123456',
|
||||
newPassword: 'hashed:abcdef'
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(SecurityPages.buildPhoneChangeBody({
|
||||
newPhone: ' 13900000000 ',
|
||||
smsCode: ' 123456 ',
|
||||
validToken: ' ticket '
|
||||
}), {
|
||||
newPhone: '13900000000',
|
||||
smsCode: '123456',
|
||||
validToken: 'ticket'
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(SecurityPages.buildSmsLoginBody({
|
||||
phone: '13900000000',
|
||||
smsCode: '123456',
|
||||
validToken: ''
|
||||
}), {
|
||||
phone: '13900000000',
|
||||
smsCode: '123456',
|
||||
validToken: undefined
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(SecurityPages.buildDeactivateBody({
|
||||
password: '123456',
|
||||
reason: ' 不再使用 '
|
||||
}, hash), {
|
||||
password: 'hashed:123456',
|
||||
reason: '不再使用'
|
||||
});
|
||||
|
||||
assert.strictEqual(SecurityPages.isDangerConfirmed('确认注销'), true);
|
||||
assert.strictEqual(SecurityPages.isDangerConfirmed('注销'), false);
|
||||
|
||||
console.log('security-pages tests passed');
|
||||
}
|
||||
|
||||
run();
|
||||
Reference in New Issue
Block a user