mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-23 05:37:11 +08:00
- MCP HTTP 支持 schema-only 模式,远程配置默认不暴露 execute_sql - OpenClaw/Hermans 向导补充安全边界与结构模式命令 - 拆分 AI 面板错误边界和 Linux CJK 字体提示组件
28 lines
1.3 KiB
TypeScript
28 lines
1.3 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { readFileSync } from 'node:fs';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const appSource = readFileSync(
|
|
fileURLToPath(new globalThis.URL('./App.tsx', import.meta.url)),
|
|
'utf8',
|
|
);
|
|
const aiPanelBoundarySource = readFileSync(
|
|
fileURLToPath(new globalThis.URL('./components/ai/AIPanelErrorBoundary.tsx', import.meta.url)),
|
|
'utf8',
|
|
);
|
|
|
|
describe('AI panel lazy-load guard', () => {
|
|
it('keeps AI panel failures scoped to the panel area with retry support', () => {
|
|
expect(appSource).toContain("import AIChatPanel from './components/AIChatPanel';");
|
|
expect(appSource).toContain("import AIPanelErrorBoundary from './components/ai/AIPanelErrorBoundary';");
|
|
expect(aiPanelBoundarySource).toContain('class AIPanelErrorBoundary extends React.Component');
|
|
expect(appSource).toContain('<AIPanelErrorBoundary');
|
|
expect(appSource).toContain('key={aiPanelRenderNonce}');
|
|
expect(appSource).toContain('AI 面板加载失败');
|
|
expect(appSource).toContain('重新加载');
|
|
expect(appSource).toContain('setAiPanelRenderNonce((current) => current + 1)');
|
|
expect(appSource).toContain('<AIChatPanel width={aiPanelRenderWidth}');
|
|
expect(appSource).not.toContain('const loadAIChatPanelModule = async (retryNonce: number) => {');
|
|
});
|
|
});
|