等待后端更新接口
This commit is contained in:
@@ -119,17 +119,23 @@ test('推广区域只把 401 视为登录失效', () => {
|
||||
assert.equal(AppPromotionPages.isUnauthorized(new Error('网络失败')), false);
|
||||
});
|
||||
|
||||
test('推广区域提供明确的未登录和空列表状态', () => {
|
||||
assert.match(
|
||||
AppPromotionPages.renderPromotionLoginRequired(),
|
||||
/<a href="login\.html">立即登录<\/a>/
|
||||
);
|
||||
assert.match(AppPromotionPages.renderPromotionList([]), /当前暂无应用推广/);
|
||||
test('推广区域将空、无权限与请求失败交给统一状态组件呈现', () => {
|
||||
const source = fs.readFileSync(path.resolve(__dirname, '../public/js/app-promotion-pages.js'), 'utf8');
|
||||
|
||||
assert.equal(AppPromotionPages.renderPromotionList([]), '');
|
||||
assert.equal(AppPromotionPages.isForbidden({ status: 403 }), true);
|
||||
assert.equal(AppPromotionPages.isForbidden({ status: 401 }), false);
|
||||
assert.match(source, /root\.ProfileUI && root\.ProfileUI\.setApiState/);
|
||||
assert.match(source, /setPromotionState\(list, 'loading', '正在读取应用推广…'\)/);
|
||||
assert.match(source, /setPromotionState\(list, 'empty', '当前暂无应用推广。'\)/);
|
||||
assert.match(source, /isForbidden\(error\) \? 'forbidden' : 'error'/);
|
||||
});
|
||||
|
||||
test('应用下载页只通过页面标记和新推广模块接入,不暴露业务 ID 输入', () => {
|
||||
assert.match(appPage, /<body[^>]*data-promotion-page/);
|
||||
assert.match(appPage, /data-promotion-list/);
|
||||
assert.match(appPage, /data-api-state="loading"/);
|
||||
assert.match(appPage, /src="public\/js\/profile-common\.js"/);
|
||||
assert.match(appPage, /src="public\/js\/app-promotion-pages\.js"/);
|
||||
assert.doesNotMatch(appPage, /src="public\/js\/promotion-pages\.js"/);
|
||||
assert.doesNotMatch(appPage, /name="(?:promotionId|coverOssId)"/);
|
||||
|
||||
Reference in New Issue
Block a user