Commit Graph

4 Commits

Author SHA1 Message Date
kurihada 7bc4f006a0 test(server): 补充 checkpoints/mcp/sse/adapter 测试
- 新增 checkpoints.test.ts: 29 个测试覆盖 Checkpoint 管理 API
- 新增 mcp.test.ts: 15 个测试覆盖 MCP 服务器管理 API
- 扩展 sse.test.ts: 添加 handleSSE 路由测试
- 扩展 adapter.test.ts: 添加 cancelProcessing, getContextUsage,
  compressContext, processMessage 测试

覆盖率提升: 60% -> 80.82%
测试数量: 288 -> 344
2025-12-15 00:32:04 +08:00
kurihada 67e129fce2 fix(commands): 修复路由顺序导致 /content 端点被遮蔽的问题
- 将 /:name{.+}/execute 和 /:name{.+}/content 路由移到 /:name{.+} 之前
- Hono 的 {.+} 模式会贪婪匹配,导致 /test/content 被解析为 name='test/content'
- 更新测试用例以正确测试 /content 端点功能
2025-12-15 00:17:22 +08:00
kurihada c44527a890 test(server): 添加 routes 模块单元测试
- agents.test.ts: Agent presets CRUD API (18 tests)
- tools.test.ts: Tool registration & execution (10 tests)
- files.test.ts: File browser API with path security (24 tests)
- commands.test.ts: Slash commands CRUD & execution (20 tests)
- hooks.test.ts: Hooks configuration management (20 tests)

覆盖率从 29.59% 提升到 60.35%,共 287 个测试
2025-12-15 00:14:27 +08:00
kurihada 5835799b69 test(server): 添加 server 模块单元测试
- 新增 vitest 配置和测试基础设施
- 添加 adapter.test.ts: 测试 Core 模块初始化和 Agent 管理 (18 tests)
- 添加 token.test.ts: 测试 Token 生成、验证和中间件 (25 tests)
- 添加 handler.test.ts: 测试权限处理器 (18 tests)
- 添加 ws.test.ts: 测试 WebSocket 连接和消息处理 (19 tests)
- 添加 sse.test.ts: 测试 SSE 事件发送 (14 tests)
- 添加 sessions.test.ts: 测试会话路由 (16 tests)
- 添加 config.test.ts: 测试配置路由 (10 tests)
- 添加 context.test.ts: 测试上下文压缩路由 (9 tests)
- 添加 providers.test.ts: 测试 Provider 管理路由 (18 tests)
- 添加 manager.test.ts: 测试 SessionManager (48 tests)

总计 195 个测试,覆盖率从 0% 提升至 29.59%
2025-12-15 00:07:32 +08:00