家谱现有接口调试50%
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
const assert = require('assert');
|
||||
const ProfilePages = require('../public/js/profile-pages.js');
|
||||
|
||||
function run() {
|
||||
assert.strictEqual(ProfilePages.pick({
|
||||
nickName: '汤小明',
|
||||
userName: '备用'
|
||||
}, ['nickName', 'userName'], '未设置'), '汤小明');
|
||||
|
||||
assert.strictEqual(ProfilePages.getAvatarText({
|
||||
nickName: '汤小明'
|
||||
}), '汤');
|
||||
|
||||
assert.deepStrictEqual(ProfilePages.buildProfileView({
|
||||
nickName: '汤小明',
|
||||
phone: '13800000000',
|
||||
sex: '1',
|
||||
birthday: '2026-07-09',
|
||||
provinceCode: '510000',
|
||||
cityCode: '510100',
|
||||
districtCode: '510104'
|
||||
}), {
|
||||
displayName: '汤小明',
|
||||
avatarText: '汤',
|
||||
phone: '13800000000',
|
||||
sex: '1',
|
||||
birthday: '2026-07-09',
|
||||
regionText: '510000 / 510100 / 510104'
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(ProfilePages.buildProfileUpdateBody({
|
||||
nickName: ' 汤小明 ',
|
||||
avatarOssId: '2060001',
|
||||
sex: '1',
|
||||
birthday: '2026-07-09',
|
||||
provinceCode: '510000',
|
||||
cityCode: '510100',
|
||||
districtCode: '510104'
|
||||
}), {
|
||||
nickName: '汤小明',
|
||||
avatarOssId: 2060001,
|
||||
sex: '1',
|
||||
birthday: '2026-07-09',
|
||||
provinceCode: '510000',
|
||||
cityCode: '510100',
|
||||
districtCode: '510104'
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(ProfilePages.buildProfileUpdateBody({
|
||||
nickName: ' ',
|
||||
avatarOssId: '',
|
||||
sex: '',
|
||||
birthday: ''
|
||||
}), {
|
||||
nickName: undefined,
|
||||
avatarOssId: undefined,
|
||||
sex: undefined,
|
||||
birthday: undefined,
|
||||
provinceCode: undefined,
|
||||
cityCode: undefined,
|
||||
districtCode: undefined
|
||||
});
|
||||
|
||||
console.log('profile-pages tests passed');
|
||||
}
|
||||
|
||||
run();
|
||||
Reference in New Issue
Block a user