(t *testing.T)
| 355 | } |
| 356 | |
| 357 | func TestClaudeEngineArgsInjection(t *testing.T) { |
| 358 | engine := NewClaudeEngine() |
| 359 | |
| 360 | t.Run("Claude engine injects args before prompt", func(t *testing.T) { |
| 361 | workflowData := &WorkflowData{ |
| 362 | EngineConfig: &EngineConfig{ |
| 363 | ID: "claude", |
| 364 | Args: []string{"--custom-flag", "value"}, |
| 365 | }, |
| 366 | Tools: make(map[string]any), |
| 367 | SafeOutputs: nil, |
| 368 | } |
| 369 | |
| 370 | steps := engine.GetExecutionSteps(workflowData, "/tmp/test.log") |
| 371 | if len(steps) == 0 { |
| 372 | t.Fatal("Expected at least one step") |
| 373 | } |
| 374 | |
| 375 | // Find the execution step |
| 376 | var executionStep GitHubActionStep |
| 377 | for _, step := range steps { |
| 378 | stepStr := strings.Join(step, "\n") |
| 379 | if strings.Contains(stepStr, "Execute Claude Code CLI") { |
| 380 | executionStep = step |
| 381 | break |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | if executionStep == nil { |
| 386 | t.Fatal("Expected to find execution step") |
| 387 | } |
| 388 | |
| 389 | stepStr := strings.Join(executionStep, "\n") |
| 390 | |
| 391 | // Check that args appear in the command |
| 392 | if !strings.Contains(stepStr, "--custom-flag value") { |
| 393 | t.Errorf("Expected to find '--custom-flag value' in step, got:\n%s", stepStr) |
| 394 | } |
| 395 | }) |
| 396 | |
| 397 | t.Run("Claude engine without args", func(t *testing.T) { |
| 398 | workflowData := &WorkflowData{ |
| 399 | EngineConfig: &EngineConfig{ |
| 400 | ID: "claude", |
| 401 | }, |
| 402 | Tools: make(map[string]any), |
| 403 | SafeOutputs: nil, |
| 404 | } |
| 405 | |
| 406 | steps := engine.GetExecutionSteps(workflowData, "/tmp/test.log") |
| 407 | if len(steps) == 0 { |
| 408 | t.Fatal("Expected at least one step") |
| 409 | } |
| 410 | |
| 411 | // Find the execution step |
| 412 | var executionStep GitHubActionStep |
| 413 | for _, step := range steps { |
| 414 | stepStr := strings.Join(step, "\n") |
nothing calls this directly
no test coverage detected