创建测试依赖
(t *testing.T)
| 16 | |
| 17 | // 创建测试依赖 |
| 18 | func createTestDependencies(t *testing.T) *agent.Dependencies { |
| 19 | jsonStore, err := store.NewJSONStore(t.TempDir()) |
| 20 | if err != nil { |
| 21 | t.Fatalf("Failed to create store: %v", err) |
| 22 | } |
| 23 | |
| 24 | toolRegistry := tools.NewRegistry() |
| 25 | templateRegistry := agent.NewTemplateRegistry() |
| 26 | providerFactory := &provider.AnthropicFactory{} |
| 27 | |
| 28 | templateRegistry.Register(&types.AgentTemplateDefinition{ |
| 29 | ID: "test-agent", |
| 30 | SystemPrompt: "You are a test agent", |
| 31 | Model: "claude-sonnet-4-5", |
| 32 | Tools: []any{}, |
| 33 | }) |
| 34 | |
| 35 | return &agent.Dependencies{ |
| 36 | Store: jsonStore, |
| 37 | SandboxFactory: sandbox.NewFactory(), |
| 38 | ToolRegistry: toolRegistry, |
| 39 | ProviderFactory: providerFactory, |
| 40 | TemplateRegistry: templateRegistry, |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | // 创建测试 Agent 配置 |
| 45 | func createTestAgentConfig(agentID string) *types.AgentConfig { |
no test coverage detected