等待后端更新接口
This commit is contained in:
@@ -99,6 +99,12 @@ test('只有未读且正常的通知提供单条已读动作', () => {
|
||||
assert.equal(NotificationPages.canMarkRead({ readStatus: '0', status: '1' }), false);
|
||||
});
|
||||
|
||||
test('通知请求的 403 显式归类为无权限,而不是登录失效', () => {
|
||||
assert.equal(NotificationPages.isForbidden({ status: 403 }), true);
|
||||
assert.equal(NotificationPages.isForbidden({ code: '403' }), true);
|
||||
assert.equal(NotificationPages.isForbidden({ status: 401 }), false);
|
||||
});
|
||||
|
||||
test('消息页提供筛选、业务详情和单条/全部已读,不显示原始 JSON', () => {
|
||||
const source = fs.readFileSync(path.join(__dirname, '..', 'profile-messages.html'), 'utf8');
|
||||
|
||||
@@ -106,8 +112,20 @@ test('消息页提供筛选、业务详情和单条/全部已读,不显示原
|
||||
assert.match(source, /data-notification-filter/);
|
||||
assert.match(source, /data-notification-list/);
|
||||
assert.match(source, /data-notification-detail/);
|
||||
assert.match(source, /data-notification-status[^>]*role="status"/);
|
||||
assert.match(source, /data-api-state="loading"/);
|
||||
assert.match(source, /data-notification-unread-count/);
|
||||
assert.match(source, /data-notification-read-all/);
|
||||
assert.match(source, /src="public\/js\/notification-pages\.js"/);
|
||||
assert.doesNotMatch(source, /src="public\/js\/pending-pages\.js"/);
|
||||
});
|
||||
|
||||
test('消息中心将列表、详情与已读操作写入统一状态组件', () => {
|
||||
const source = fs.readFileSync(path.join(__dirname, '..', 'public/js/notification-pages.js'), 'utf8');
|
||||
|
||||
assert.match(source, /root\.ProfileUI && root\.ProfileUI\.setApiState/);
|
||||
assert.match(source, /setNotificationState\(container, 'empty', '当前暂无通知。'\)/);
|
||||
assert.match(source, /setNotificationState\(query\('\[data-notification-detail\]'\), 'loading', '正在读取通知详情…'\)/);
|
||||
assert.match(source, /updateStatus\('loading', '正在标记通知为已读…'\)/);
|
||||
assert.match(source, /isForbidden\(error\) \? 'forbidden' : 'error'/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user