mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-06-14 10:29:52 +08:00
- 调整 Claude Code 和 Codex 的安装文案与状态标签,明确是把 GoNavi 暴露给外部客户端使用 - 优化 MCP 客户端默认选择逻辑,优先聚焦未接入或需更新的目标并避免刷新后乱跳 - 同步补齐前端 mock、后端状态文案和定向测试,确保安装区交互与状态展示一致
108 lines
3.9 KiB
TypeScript
108 lines
3.9 KiB
TypeScript
import React from 'react';
|
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
import AIMCPClientInstallPanel from './AIMCPClientInstallPanel';
|
|
import { buildOverlayWorkbenchTheme } from '../../utils/overlayWorkbenchTheme';
|
|
|
|
describe('AIMCPClientInstallPanel', () => {
|
|
it('renders a clearer external-client selection flow instead of parallel install buttons', () => {
|
|
const markup = renderToStaticMarkup(
|
|
<AIMCPClientInstallPanel
|
|
statuses={[
|
|
{
|
|
client: 'claude-code',
|
|
displayName: 'Claude Code',
|
|
installed: false,
|
|
matchesCurrent: false,
|
|
message: '未检测到 Claude Code 用户级 GoNavi MCP 配置',
|
|
},
|
|
{
|
|
client: 'codex',
|
|
displayName: 'Codex',
|
|
installed: true,
|
|
matchesCurrent: false,
|
|
message: '已检测到 Codex 中的 GoNavi MCP 记录,但与当前 GoNavi 安装路径不一致,建议更新',
|
|
configPath: '~/.codex/config.toml',
|
|
command: 'gonavi-mcp-server',
|
|
args: ['stdio'],
|
|
},
|
|
]}
|
|
selectedClient="codex"
|
|
selectedStatus={{
|
|
client: 'codex',
|
|
displayName: 'Codex',
|
|
installed: true,
|
|
matchesCurrent: false,
|
|
message: '已检测到 Codex 中的 GoNavi MCP 记录,但与当前 GoNavi 安装路径不一致,建议更新',
|
|
configPath: '~/.codex/config.toml',
|
|
command: 'gonavi-mcp-server',
|
|
args: ['stdio'],
|
|
}}
|
|
selectedCommandText="gonavi-mcp-server stdio"
|
|
darkMode={false}
|
|
overlayTheme={buildOverlayWorkbenchTheme(false)}
|
|
cardBg="#fff"
|
|
cardBorder="rgba(0,0,0,0.08)"
|
|
loading={false}
|
|
statusLoading={false}
|
|
onSelectClient={() => {}}
|
|
onRefreshStatus={() => {}}
|
|
onCopyConfigPath={() => {}}
|
|
onCopyLaunchCommand={() => {}}
|
|
onInstall={() => {}}
|
|
/>,
|
|
);
|
|
|
|
expect(markup).toContain('不是给 GoNavi 自己再装一个 MCP');
|
|
expect(markup).toContain('把 GoNavi MCP 接入外部 AI 客户端');
|
|
expect(markup).toContain('第 1 步:选择目标客户端');
|
|
expect(markup).toContain('第 2 步:确认状态后写入');
|
|
expect(markup).toContain('未接入');
|
|
expect(markup).toContain('需更新');
|
|
expect(markup).toContain('复制配置路径');
|
|
expect(markup).toContain('复制启动命令');
|
|
expect(markup).toContain('更新 Codex 配置');
|
|
expect(markup).toContain('不会下载 Claude Code / Codex');
|
|
});
|
|
|
|
it('shows an already-connected label when the selected client matches the current GoNavi path', () => {
|
|
const markup = renderToStaticMarkup(
|
|
<AIMCPClientInstallPanel
|
|
statuses={[
|
|
{
|
|
client: 'claude-code',
|
|
displayName: 'Claude Code',
|
|
installed: true,
|
|
matchesCurrent: true,
|
|
message: '已检测到 Claude Code 用户级 GoNavi MCP 配置,且与当前 GoNavi 安装路径一致',
|
|
},
|
|
]}
|
|
selectedClient="claude-code"
|
|
selectedStatus={{
|
|
client: 'claude-code',
|
|
displayName: 'Claude Code',
|
|
installed: true,
|
|
matchesCurrent: true,
|
|
message: '已检测到 Claude Code 用户级 GoNavi MCP 配置,且与当前 GoNavi 安装路径一致',
|
|
}}
|
|
selectedCommandText="gonavi-mcp-server stdio"
|
|
darkMode={false}
|
|
overlayTheme={buildOverlayWorkbenchTheme(false)}
|
|
cardBg="#fff"
|
|
cardBorder="rgba(0,0,0,0.08)"
|
|
loading={false}
|
|
statusLoading={false}
|
|
onSelectClient={() => {}}
|
|
onRefreshStatus={() => {}}
|
|
onCopyConfigPath={() => {}}
|
|
onCopyLaunchCommand={() => {}}
|
|
onInstall={() => {}}
|
|
/>,
|
|
);
|
|
|
|
expect(markup).toContain('已接入');
|
|
expect(markup).toContain('已接入 Claude Code');
|
|
});
|
|
});
|