diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-03-07 23:49:54 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-03-08 04:41:35 +0000 |
| commit | f78d7f2aa5d07c8ac7ba65f87fe66ea21bc1075a (patch) | |
| tree | 9a24bf8353a6498c964080d665079b36cf2f0bc7 /internal | |
| parent | cad057fd64fbf44f953bc2784f70ce344f3389cf (diff) | |
test(task): update validator and parser tests to use AgentConfig
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/task/parser_test.go | 25 | ||||
| -rw-r--r-- | internal/task/validator_test.go | 9 |
2 files changed, 21 insertions, 13 deletions
diff --git a/internal/task/parser_test.go b/internal/task/parser_test.go index cb68e86..7c3aadc 100644 --- a/internal/task/parser_test.go +++ b/internal/task/parser_test.go @@ -11,7 +11,8 @@ func TestParse_SingleTask(t *testing.T) { yaml := ` name: "Test Task" description: "A simple test" -claude: +agent: + type: "claude" model: "sonnet" instructions: "Do something" working_dir: "/tmp" @@ -30,8 +31,8 @@ tags: if task.Name != "Test Task" { t.Errorf("expected name 'Test Task', got %q", task.Name) } - if task.Claude.Model != "sonnet" { - t.Errorf("expected model 'sonnet', got %q", task.Claude.Model) + if task.Agent.Model != "sonnet" { + t.Errorf("expected model 'sonnet', got %q", task.Agent.Model) } if task.Timeout.Duration != 10*time.Minute { t.Errorf("expected timeout 10m, got %v", task.Timeout.Duration) @@ -51,12 +52,14 @@ func TestParse_BatchTasks(t *testing.T) { yaml := ` tasks: - name: "Task A" - claude: + agent: + type: "claude" instructions: "Do A" working_dir: "/tmp" tags: ["alpha"] - name: "Task B" - claude: + agent: + type: "claude" instructions: "Do B" working_dir: "/tmp" tags: ["beta"] @@ -79,7 +82,8 @@ tasks: func TestParse_MissingName_ReturnsError(t *testing.T) { yaml := ` description: "no name" -claude: +agent: + type: "claude" instructions: "something" ` _, err := Parse([]byte(yaml)) @@ -91,7 +95,8 @@ claude: func TestParse_DefaultRetryConfig(t *testing.T) { yaml := ` name: "Defaults" -claude: +agent: + type: "claude" instructions: "test" ` tasks, err := Parse([]byte(yaml)) @@ -110,7 +115,8 @@ func TestParse_WithPriority(t *testing.T) { yaml := ` name: "High Priority" priority: "high" -claude: +agent: + type: "claude" instructions: "urgent" ` tasks, err := Parse([]byte(yaml)) @@ -127,7 +133,8 @@ func TestParseFile(t *testing.T) { path := filepath.Join(dir, "task.yaml") content := ` name: "File Task" -claude: +agent: + type: "claude" instructions: "from file" working_dir: "/tmp" ` diff --git a/internal/task/validator_test.go b/internal/task/validator_test.go index 967eed3..5678a00 100644 --- a/internal/task/validator_test.go +++ b/internal/task/validator_test.go @@ -9,7 +9,8 @@ func validTask() *Task { return &Task{ ID: "test-id", Name: "Valid Task", - Claude: ClaudeConfig{ + Agent: AgentConfig{ + Type: "claude", Instructions: "do something", WorkingDir: "/tmp", }, @@ -39,7 +40,7 @@ func TestValidate_MissingName_ReturnsError(t *testing.T) { func TestValidate_MissingInstructions_ReturnsError(t *testing.T) { task := validTask() - task.Claude.Instructions = "" + task.Agent.Instructions = "" err := Validate(task) if err == nil { t.Fatal("expected error") @@ -51,7 +52,7 @@ func TestValidate_MissingInstructions_ReturnsError(t *testing.T) { func TestValidate_NegativeBudget_ReturnsError(t *testing.T) { task := validTask() - task.Claude.MaxBudgetUSD = -1.0 + task.Agent.MaxBudgetUSD = -1.0 err := Validate(task) if err == nil { t.Fatal("expected error") @@ -87,7 +88,7 @@ func TestValidate_InvalidPriority_ReturnsError(t *testing.T) { func TestValidate_InvalidPermissionMode_ReturnsError(t *testing.T) { task := validTask() - task.Claude.PermissionMode = "yolo" + task.Agent.PermissionMode = "yolo" err := Validate(task) if err == nil { t.Fatal("expected error") |
