修改功能
This commit is contained in:
+25
-17
@@ -9,6 +9,7 @@ const root = path.resolve(__dirname, '..');
|
||||
const packageId = '2062179707935264769';
|
||||
const genealogyId = '2062179707935264770';
|
||||
const orderId = '2062179707935264771';
|
||||
const transactionId = '2062179707935264772';
|
||||
|
||||
function packageFixture(overrides) {
|
||||
return Object.assign({
|
||||
@@ -49,7 +50,10 @@ function orderFixture(overrides) {
|
||||
payTime: null,
|
||||
expireTime: null,
|
||||
status: '0',
|
||||
remark: ''
|
||||
remark: '',
|
||||
transactionId,
|
||||
canRefreshPayment: true,
|
||||
canClose: true
|
||||
}, overrides);
|
||||
}
|
||||
|
||||
@@ -124,7 +128,7 @@ test('家谱选择项只接受响应中的稳定 ID 和名称', () => {
|
||||
], 'unsafe'), '');
|
||||
});
|
||||
|
||||
test('订单请求只构造 AppVipOrderBody 且页面默认省略支付方式', () => {
|
||||
test('订单请求只构造 PcVipOrderBody,支付方式由后端确定', () => {
|
||||
assert.deepEqual(VipPages.buildVipOrderBody({
|
||||
packageId: ' ' + packageId + ' ',
|
||||
genealogyId: ' ' + genealogyId + ' ',
|
||||
@@ -140,8 +144,7 @@ test('订单请求只构造 AppVipOrderBody 且页面默认省略支付方式',
|
||||
packageId,
|
||||
payType: ' wechat '
|
||||
}), {
|
||||
packageId,
|
||||
payType: 'wechat'
|
||||
packageId
|
||||
});
|
||||
});
|
||||
|
||||
@@ -153,10 +156,7 @@ test('订单请求要求安全套餐 ID,并只接受已确认的可选值', ()
|
||||
packageId,
|
||||
genealogyId: 'unsafe'
|
||||
}), /家谱/);
|
||||
assert.match(VipPages.validateVipOrderBody({
|
||||
packageId,
|
||||
payType: 'alipay'
|
||||
}), /支付方式/);
|
||||
assert.equal(VipPages.validateVipOrderBody({ packageId, payType: 'alipay' }), '');
|
||||
});
|
||||
|
||||
test('VIP 订单隐藏账号字段并校验金额和状态', () => {
|
||||
@@ -175,7 +175,10 @@ test('VIP 订单隐藏账号字段并校验金额和状态', () => {
|
||||
payTime: '',
|
||||
expireTime: '',
|
||||
status: '0',
|
||||
remark: ''
|
||||
remark: '',
|
||||
transactionId,
|
||||
canRefreshPayment: true,
|
||||
canClose: true
|
||||
});
|
||||
assert.equal(VipPages.normalizeVipOrder(orderFixture({
|
||||
orderId: Number.MAX_SAFE_INTEGER + 1
|
||||
@@ -191,7 +194,7 @@ test('VIP 订单隐藏账号字段并校验金额和状态', () => {
|
||||
})), null);
|
||||
});
|
||||
|
||||
test('套餐和订单渲染不出现内部账号信息或伪支付操作', () => {
|
||||
test('套餐和订单渲染不出现内部账号信息,并按服务端能力提供支付操作', () => {
|
||||
const packagesHtml = VipPages.renderVipPackages([packageFixture({
|
||||
packageName: '<年度会员>'
|
||||
})], packageId);
|
||||
@@ -204,7 +207,9 @@ test('套餐和订单渲染不出现内部账号信息或伪支付操作', () =>
|
||||
assert.match(packagesHtml, /<年度会员>/);
|
||||
assert.match(packagesHtml, new RegExp('data-vip-package-id="' + packageId + '"'));
|
||||
assert.match(ordersHtml, /待支付/);
|
||||
assert.doesNotMatch(combined, /secret-user|secret-phone|appUserId|appUserPhone|立即支付|模拟|取消订单|退款/);
|
||||
assert.match(ordersHtml, /data-vip-payment-refresh/);
|
||||
assert.match(ordersHtml, /data-vip-payment-close/);
|
||||
assert.doesNotMatch(combined, /secret-user|secret-phone|appUserId|appUserPhone|模拟支付|取消订单|退款/);
|
||||
});
|
||||
|
||||
test('套餐渲染接受初始化流程已经规范化的数据', () => {
|
||||
@@ -216,7 +221,7 @@ test('套餐渲染接受初始化流程已经规范化的数据', () => {
|
||||
assert.doesNotMatch(html, /当前没有可用会员套餐/);
|
||||
});
|
||||
|
||||
test('会员服务页只从接口结果选择套餐和家谱,不暴露业务 ID 或未开放支付操作', () => {
|
||||
test('会员服务页只从接口结果选择套餐和家谱,并使用微信扫码支付', () => {
|
||||
const source = fs.readFileSync(path.join(root, 'profile-services.html'), 'utf8');
|
||||
|
||||
assert.doesNotMatch(source, /data-feature-status="pending"/);
|
||||
@@ -231,7 +236,9 @@ test('会员服务页只从接口结果选择套餐和家谱,不暴露业务 I
|
||||
assert.match(source, /data-api-state="loading"/);
|
||||
assert.doesNotMatch(source, /<input[^>]+name="(?:packageId|genealogyId|orderId)"/);
|
||||
assert.doesNotMatch(source, /name="payType"/);
|
||||
assert.doesNotMatch(source, /立即支付|模拟支付|取消订单|退款/);
|
||||
assert.match(source, /data-vip-payment-panel/);
|
||||
assert.match(source, /public\/js\/qrcode\.min\.js/);
|
||||
assert.doesNotMatch(source, /模拟支付|取消订单|退款/);
|
||||
assert.ok(source.indexOf('src="public/js/profile-common.js"') < source.indexOf('src="public/js/vip-pages.js"'));
|
||||
});
|
||||
|
||||
@@ -244,16 +251,17 @@ test('会员服务页补齐桌面端设置与协议入口,不伪造账户接
|
||||
assert.match(source, /href="children-privacy\.html"/);
|
||||
assert.match(source, /href="terms\.html"/);
|
||||
assert.match(source, /个性化推荐/);
|
||||
assert.match(source, /当前 PC 接口未提供推荐偏好的读取或保存/);
|
||||
assert.match(source, /推荐设置正在完善,目前不会保存开关状态/);
|
||||
assert.doesNotMatch(source, /data-setting-form|data-withdraw-form|data-share-reward/);
|
||||
assert.doesNotMatch(source, /data-recommendation-toggle|name="recommendation"/);
|
||||
});
|
||||
|
||||
test('会员服务运行时并行读取套餐、我的家谱和订单,并在创建后重新读取核验', () => {
|
||||
test('会员服务运行时读取支付能力并展示后端返回的 NATIVE 支付单', () => {
|
||||
const source = fs.readFileSync(path.join(root, 'public/js/vip-pages.js'), 'utf8');
|
||||
|
||||
assert.match(source, /Promise\.all\(\[api\.vipPackages\(\), api\.genealogiesMine\(\), api\.vipOrders\(\)\]\)/);
|
||||
assert.match(source, /created = normalizeVipOrder\(await api\.createVipOrder\(body\)\)/);
|
||||
assert.match(source, /api\.vipCapability\(\), api\.vipPackages\(\), api\.genealogiesMine\(\), api\.vipOrders\(\)/);
|
||||
assert.match(source, /payment = normalizePaymentOrder\(await api\.createVipOrder\(body\)\)/);
|
||||
assert.match(source, /showPayment\(payment\)/);
|
||||
assert.match(source, /refreshed = normalizeVipOrders\(await api\.vipOrders\(\)\)/);
|
||||
assert.match(source, /item\.orderId === created\.orderId/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user