等待后端更新接口
This commit is contained in:
@@ -112,6 +112,16 @@ test('家谱选择项只接受响应中的稳定 ID 和名称', () => {
|
||||
genealogyId,
|
||||
genealogyName: ''
|
||||
}), null);
|
||||
assert.deepEqual(VipPages.normalizeGenealogyOptions([
|
||||
{ genealogyId, genealogyName: '叶氏家谱', surname: '叶' },
|
||||
{ genealogyId: 'unsafe', genealogyName: '无效家谱' }
|
||||
]), [{ genealogyId, genealogyName: '叶氏家谱', surname: '叶' }]);
|
||||
assert.equal(VipPages.resolveContextGenealogyId([
|
||||
{ genealogyId, genealogyName: '叶氏家谱', surname: '叶' }
|
||||
], genealogyId), genealogyId);
|
||||
assert.equal(VipPages.resolveContextGenealogyId([
|
||||
{ genealogyId, genealogyName: '叶氏家谱', surname: '叶' }
|
||||
], 'unsafe'), '');
|
||||
});
|
||||
|
||||
test('订单请求只构造 AppVipOrderBody 且页面默认省略支付方式', () => {
|
||||
@@ -216,9 +226,27 @@ test('会员服务页只从接口结果选择套餐和家谱,不暴露业务 I
|
||||
assert.match(source, /<select[^>]+data-vip-genealogy-options/);
|
||||
assert.match(source, /data-vip-order-refresh/);
|
||||
assert.match(source, /data-vip-order-list/);
|
||||
assert.match(source, /data-vip-order-form novalidate/);
|
||||
assert.match(source, /data-vip-order-status[^>]*role="status"/);
|
||||
assert.match(source, /data-api-state="loading"/);
|
||||
assert.doesNotMatch(source, /<input[^>]+name="(?:packageId|genealogyId|orderId)"/);
|
||||
assert.doesNotMatch(source, /name="payType"/);
|
||||
assert.doesNotMatch(source, /立即支付|模拟支付|取消订单|退款/);
|
||||
assert.ok(source.indexOf('src="public/js/profile-common.js"') < source.indexOf('src="public/js/vip-pages.js"'));
|
||||
});
|
||||
|
||||
test('会员服务页补齐桌面端设置与协议入口,不伪造账户接口', () => {
|
||||
const source = fs.readFileSync(path.join(root, 'profile-services.html'), 'utf8');
|
||||
|
||||
assert.match(source, /平台设置与协议/);
|
||||
assert.match(source, /href="about\.html"/);
|
||||
assert.match(source, /href="privacy\.html"/);
|
||||
assert.match(source, /href="children-privacy\.html"/);
|
||||
assert.match(source, /href="terms\.html"/);
|
||||
assert.match(source, /个性化推荐/);
|
||||
assert.match(source, /当前 PC 接口未提供推荐偏好的读取或保存/);
|
||||
assert.doesNotMatch(source, /data-setting-form|data-withdraw-form|data-share-reward/);
|
||||
assert.doesNotMatch(source, /data-recommendation-toggle|name="recommendation"/);
|
||||
});
|
||||
|
||||
test('会员服务运行时并行读取套餐、我的家谱和订单,并在创建后重新读取核验', () => {
|
||||
@@ -229,3 +257,16 @@ test('会员服务运行时并行读取套餐、我的家谱和订单,并在
|
||||
assert.match(source, /refreshed = normalizeVipOrders\(await api\.vipOrders\(\)\)/);
|
||||
assert.match(source, /item\.orderId === created\.orderId/);
|
||||
});
|
||||
|
||||
test('会员服务将加载、空数据、提交校验与请求失败写入统一状态组件', () => {
|
||||
const source = fs.readFileSync(path.join(root, 'public/js/vip-pages.js'), 'utf8');
|
||||
|
||||
assert.match(source, /function setApiState\(target, type, message\)/);
|
||||
assert.match(source, /root\.ProfileUI && root\.ProfileUI\.setApiState/);
|
||||
assert.match(source, /setListState\(packageList, 'loading', '正在读取会员套餐…'\)/);
|
||||
assert.match(source, /setListState\(orderList, 'empty', '当前没有会员订单。'\)/);
|
||||
assert.match(source, /setStatus\('error', validation\)/);
|
||||
assert.match(source, /setPendingButton\(submit, true, '正在创建订单…'\)/);
|
||||
assert.match(source, /root\.ProfileUI && typeof root\.ProfileUI\.getGenealogyId === 'function'/);
|
||||
assert.match(source, /已关联当前家谱,请选择会员套餐/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user