(t *testing.T)
| 22 | } |
| 23 | |
| 24 | func TestCodexEngine(t *testing.T) { |
| 25 | engine := NewCodexEngine() |
| 26 | |
| 27 | // Test basic properties |
| 28 | if engine.GetID() != "codex" { |
| 29 | t.Errorf("Expected ID 'codex', got '%s'", engine.GetID()) |
| 30 | } |
| 31 | |
| 32 | if engine.GetDisplayName() != "Codex" { |
| 33 | t.Errorf("Expected display name 'Codex', got '%s'", engine.GetDisplayName()) |
| 34 | } |
| 35 | |
| 36 | if engine.IsExperimental() { |
| 37 | t.Error("Codex engine should not be experimental") |
| 38 | } |
| 39 | |
| 40 | if !engine.GetCapabilities().ToolsAllowlist { |
| 41 | t.Error("Codex engine should support MCP tools") |
| 42 | } |
| 43 | |
| 44 | // Test installation steps |
| 45 | steps := engine.GetInstallationSteps(&WorkflowData{}) |
| 46 | // Secret validation is now in the activation job; installation has Node.js setup + Install Codex = 2 steps |
| 47 | expectedStepCount := 2 |
| 48 | if len(steps) != expectedStepCount { |
| 49 | t.Errorf("Expected %d installation steps, got %d", expectedStepCount, len(steps)) |
| 50 | } |
| 51 | |
| 52 | // Verify first step is Node.js setup |
| 53 | if len(steps) > 0 && len(steps[0]) > 0 { |
| 54 | if !strings.Contains(steps[0][0], "Setup Node.js") { |
| 55 | t.Errorf("Expected first step to contain 'Setup Node.js', got '%s'", steps[0][0]) |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | // Verify second step is Install Codex CLI |
| 60 | if len(steps) > 1 && len(steps[1]) > 0 { |
| 61 | if !strings.Contains(steps[1][0], "Install Codex CLI") { |
| 62 | t.Errorf("Expected second step to contain 'Install Codex CLI', got '%s'", steps[1][0]) |
| 63 | } |
| 64 | if strings.Contains(strings.Join([]string(steps[1]), "\n"), "NPM_CONFIG_MIN_RELEASE_AGE") { |
| 65 | t.Errorf("Expected no npm release-age cooldown env for Codex install, got '%s'", strings.Join([]string(steps[1]), "\n")) |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | // Test execution steps |
| 70 | workflowData := &WorkflowData{ |
| 71 | Name: "test-workflow", |
| 72 | } |
| 73 | execSteps := engine.GetExecutionSteps(workflowData, "test-log") |
| 74 | if len(execSteps) != 1 { |
| 75 | t.Fatalf("Expected 1 step for Codex execution, got %d", len(execSteps)) |
| 76 | } |
| 77 | |
| 78 | // Check the execution step |
| 79 | stepContent := strings.Join([]string(execSteps[0]), "\n") |
| 80 | |
| 81 | if !strings.Contains(stepContent, "name: Execute Codex CLI") { |
nothing calls this directly
no test coverage detected