(t *testing.T)
| 23 | } |
| 24 | |
| 25 | func TestTaskTool_InputSchema(t *testing.T) { |
| 26 | tool, err := NewTaskTool(nil) |
| 27 | if err != nil { |
| 28 | t.Fatalf("Failed to create Task tool: %v", err) |
| 29 | } |
| 30 | |
| 31 | schema := tool.InputSchema() |
| 32 | if schema == nil { |
| 33 | t.Fatal("Input schema should not be nil") |
| 34 | } |
| 35 | |
| 36 | properties, ok := schema["properties"].(map[string]any) |
| 37 | if !ok { |
| 38 | t.Fatal("Properties should be a map") |
| 39 | } |
| 40 | |
| 41 | // 验证关键字段存在 |
| 42 | expectedFields := []string{"action", "subagent_type", "prompt", "task_id"} |
| 43 | for _, field := range expectedFields { |
| 44 | if _, exists := properties[field]; !exists { |
| 45 | t.Errorf("Field '%s' should exist in properties", field) |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | // 验证 required 字段(当前实现没有必需字段,因为不同 action 需要不同参数) |
| 50 | required := schema["required"] |
| 51 | var requiredArray []any |
| 52 | switch v := required.(type) { |
| 53 | case []any: |
| 54 | requiredArray = v |
| 55 | case []string: |
| 56 | requiredArray = make([]any, len(v)) |
| 57 | for i, s := range v { |
| 58 | requiredArray[i] = s |
| 59 | } |
| 60 | default: |
| 61 | t.Fatal("Required should be an array") |
| 62 | } |
| 63 | |
| 64 | // 当前实现 required 为空(action 有默认值,其他参数根据 action 类型决定) |
| 65 | if len(requiredArray) != 0 { |
| 66 | t.Logf("Note: required fields count is %d (expected 0 for action-based schema)", len(requiredArray)) |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | func TestTaskTool_LaunchGeneralPurposeSubagent(t *testing.T) { |
| 71 | tool, err := NewTaskTool(nil) |
nothing calls this directly
no test coverage detected