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

Function TestSubAgentManagerFactory

pkg/agent/subagent_test.go:65–107  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

63}
64
65func TestSubAgentManagerFactory(t *testing.T) {
66 deps := &Dependencies{
67 TemplateRegistry: NewTemplateRegistry(),
68 }
69
70 mgr := NewSubAgentManager(deps)
71 factory := NewSubAgentManagerFactory(mgr)
72
73 // 测试 ListTypes
74 types := factory.ListTypes()
75 if len(types) == 0 {
76 t.Error("expected factory to list types")
77 }
78
79 // 验证包含内置类型
80 hasExplore := false
81 hasPlan := false
82 for _, typ := range types {
83 if typ == "Explore" {
84 hasExplore = true
85 }
86 if typ == "Plan" {
87 hasPlan = true
88 }
89 }
90 if !hasExplore {
91 t.Error("expected 'Explore' in types")
92 }
93 if !hasPlan {
94 t.Error("expected 'Plan' in types")
95 }
96
97 // 测试 Create
98 executor, err := factory.Create("Explore")
99 if err != nil {
100 t.Fatalf("failed to create executor: %v", err)
101 }
102
103 spec := executor.GetSpec()
104 if spec.Name != "Explore" {
105 t.Errorf("expected spec name 'Explore', got '%s'", spec.Name)
106 }
107}
108
109func TestTruncateString(t *testing.T) {
110 tests := []struct {

Callers

nothing calls this directly

Calls 7

ListTypesMethod · 0.95
CreateMethod · 0.95
NewTemplateRegistryFunction · 0.85
NewSubAgentManagerFunction · 0.85
ErrorMethod · 0.65
GetSpecMethod · 0.65

Tested by

no test coverage detected