(t *testing.T)
| 63 | } |
| 64 | |
| 65 | func 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 | |
| 109 | func TestTruncateString(t *testing.T) { |
| 110 | tests := []struct { |
nothing calls this directly
no test coverage detected