MCPcopy Create free account
hub / github.com/astercloud/aster / createTestDeps

Function createTestDeps

pkg/core/pool_test.go:18–44  ·  view source on GitHub ↗

创建测试用的 Dependencies

(t *testing.T)

Source from the content-addressed store, hash-verified

16
17// 创建测试用的 Dependencies
18func createTestDeps(t *testing.T) *agent.Dependencies {
19 // 使用 JSONStore 代替 MemoryStore
20 memStore, err := store.NewJSONStore(t.TempDir())
21 if err != nil {
22 t.Fatalf("Failed to create store: %v", err)
23 }
24
25 toolRegistry := tools.NewRegistry()
26 templateRegistry := agent.NewTemplateRegistry()
27 providerFactory := &provider.AnthropicFactory{}
28
29 // 注册测试模板
30 templateRegistry.Register(&types.AgentTemplateDefinition{
31 ID: "test-template",
32 SystemPrompt: "You are a test assistant",
33 Model: "claude-sonnet-4-5",
34 Tools: []any{},
35 })
36
37 return &agent.Dependencies{
38 Store: memStore,
39 SandboxFactory: sandbox.NewFactory(),
40 ToolRegistry: toolRegistry,
41 ProviderFactory: providerFactory,
42 TemplateRegistry: templateRegistry,
43 }
44}
45
46// 创建测试用的 AgentConfig 辅助函数
47func createTestConfig(agentID string) *types.AgentConfig {

Callers 15

TestRoom_JoinAndLeaveFunction · 0.85
TestRoom_JoinDuplicateFunction · 0.85
TestRoom_GetMembersFunction · 0.85
TestRoom_SayFunction · 0.85
TestRoom_BroadcastFunction · 0.85
TestRoom_SendToFunction · 0.85
TestRoom_ClearHistoryFunction · 0.85
TestPool_CreateFunction · 0.85
TestPool_CreateDuplicateFunction · 0.85
TestPool_MaxCapacityFunction · 0.85
TestPool_ListFunction · 0.85

Calls 5

RegisterMethod · 0.95
NewJSONStoreFunction · 0.92
NewRegistryFunction · 0.92
NewTemplateRegistryFunction · 0.92
NewFactoryFunction · 0.92

Tested by

no test coverage detected