重构:完成架构一致性整改与生命周期收口

This commit is contained in:
Christ committed 2026-08-18 14:05:08 +08:00
1 parent 55904cc409
commit 9eb6be2875
344 files changed
+15961 -13926

No files matched your search

+8 -8
View File
@@ -13,20 +13,20 @@ describe('online chat UI contract', () => {
expect(chat).not.toContain('grid-cols-[320px_minmax(0,1fr)_');
expect(chat).toContain('activeAccountID');
expect(chat).toContain('activeChatID');
} /* 回调函数负责当前业务流程。 */);
} /* 测试回调断言聊天页的账号标签和双栏布局契约。 */);
test('uses neutral user labels instead of assuming buyer role', () => {
const chat = source('app/features/chat/pages/Chat.tsx'); /* chat 表示chat。 */
expect(chat).toContain('用户 ID:');
expect(chat).not.toContain('买家 ID:');
expect(chat).not.toContain('选择一个买家');
} /* 回调函数负责当前业务流程。 */);
} /* 测试回调断言用户标签不误用买家角色。 */);
test('frontend connects only to the application chat websocket', () => {
const chatHook = source('app/features/chat/hooks.ts'); /* chatHook 表示chatHook。 */
expect(chatHook).toContain('/api/v1/chat/ws');
expect(chatHook).not.toContain('wss-goofish.dingtalk.com');
} /* 回调函数负责当前业务流程。 */);
} /* 测试回调断言前端只连接应用层聊天 WebSocket。 */);
test('renders peer/self identity and verified media capabilities', () => {
const chat = source('app/features/chat/pages/Chat.tsx'); /* chat 表示chat。 */
@@ -36,13 +36,13 @@ describe('online chat UI contract', () => {
expect(chat).toContain("message.message_type === 'image'");
expect(chat).toContain("message.message_type === 'video'");
expect(chatHook).toContain('sendChatImage');
} /* 回调函数负责当前业务流程。 */);
} /* 测试回调断言头像、媒体类型及发送 API 的渲染能力。 */);
test('renders official notices as neutral system messages', () => {
const chat = source('app/features/chat/pages/Chat.tsx'); /* chat 表示chat。 */
expect(chat).toContain("message.message_type === 'system'");
expect(chat).toContain('justify-center py-1');
} /* 回调函数负责当前业务流程。 */);
} /* 测试回调断言平台通知以居中的系统消息呈现。 */);
test('keeps the active chat at the bottom when new messages arrive', () => {
const chat = source('app/features/chat/pages/Chat.tsx'); /* chat 表示chat。 */
@@ -52,12 +52,12 @@ describe('online chat UI contract', () => {
expect(chat).toContain('onScroll={handleMessageScroll}');
expect(chatHook).toContain('container.scrollHeight - container.scrollTop - container.clientHeight');
expect(chatHook).toContain('[activeAccountID, activeChatID, messages, messagesLoading]');
} /* 回调函数负责当前业务流程。 */);
} /* 测试回调断言新消息到达时当前会话保持滚动到底部。 */);
test('sidebar exposes collapse control and chat primary navigation', () => {
const sidebar = source('shared/ui/Sidebar.tsx'); /* sidebar 表示sidebar。 */
expect(sidebar).toContain("id: 'chat'");
expect(sidebar).toContain('onToggleCollapsed');
expect(sidebar).toContain('collapsed ? \'w-16\' : \'w-64\'');
} /* 回调函数负责当前业务流程。 */);
} /* 回调函数负责当前业务流程。 */);
} /* 测试回调断言侧边栏折叠控制和聊天主导航入口。 */);
} /* 测试套件回调汇总聊天页面结构契约。 */);