家谱现有接口调试50%
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
const assert = require('assert');
|
||||
const VipPages = require('../public/js/vip-pages.js');
|
||||
|
||||
function run() {
|
||||
assert.deepStrictEqual(VipPages.normalizeList({ rows: [{ packageId: 1 }] }), [{ packageId: 1 }]);
|
||||
assert.deepStrictEqual(VipPages.normalizeList({ records: [{ packageId: 2 }] }), [{ packageId: 2 }]);
|
||||
|
||||
assert.deepStrictEqual(VipPages.buildVipOrderBody({
|
||||
packageId: ' 900060001 ',
|
||||
genealogyId: ' 900001001 ',
|
||||
payType: 'wechat'
|
||||
}), {
|
||||
packageId: 900060001,
|
||||
genealogyId: 900001001,
|
||||
payType: 'wechat'
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(VipPages.buildVipOrderBody({
|
||||
packageId: '900060002',
|
||||
genealogyId: '',
|
||||
payType: ''
|
||||
}), {
|
||||
packageId: 900060002,
|
||||
genealogyId: undefined,
|
||||
payType: undefined
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
VipPages.buildPackageCard({
|
||||
packageId: 900060001,
|
||||
packageName: '年度会员',
|
||||
price: 199,
|
||||
durationDays: 365,
|
||||
description: '适合长期维护家谱'
|
||||
}),
|
||||
'<button class="vip-package-card" type="button" data-vip-package-id="900060001"><span class="vip-package-name">年度会员</span><strong>¥199</strong><small>365天</small><p>适合长期维护家谱</p></button>'
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
VipPages.buildOrderRow({
|
||||
orderNo: 'VIP202607090001',
|
||||
packageName: '年度会员',
|
||||
payType: 'wechat',
|
||||
orderStatus: 'created'
|
||||
}),
|
||||
'<div class="module-row vip-order-row"><div><h3>年度会员</h3><p>VIP202607090001 · 微信支付 · created</p></div><span class="pill">订单</span></div>'
|
||||
);
|
||||
|
||||
console.log('vip-pages tests passed');
|
||||
}
|
||||
|
||||
run();
|
||||
Reference in New Issue
Block a user