MCPcopy Create free account
hub / github.com/github/gh-aw / TestCodexEngineWithVersion

Function TestCodexEngineWithVersion

pkg/workflow/codex_engine_test.go:126–166  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

124}
125
126func TestCodexEngineWithVersion(t *testing.T) {
127 engine := NewCodexEngine()
128
129 // Test installation steps without version (should use pinned default version)
130 stepsNoVersion := engine.GetInstallationSteps(&WorkflowData{})
131 foundNoVersionInstall := false
132 expectedPackage := fmt.Sprintf("@openai/codex@%s", constants.DefaultCodexVersion)
133 for _, step := range stepsNoVersion {
134 for _, line := range step {
135 if strings.Contains(line, "npm install") && strings.Contains(line, expectedPackage) {
136 foundNoVersionInstall = true
137 break
138 }
139 }
140 }
141 if !foundNoVersionInstall {
142 t.Errorf("Expected npm install command with @%s when no version specified", constants.DefaultCodexVersion)
143 }
144
145 // Test installation steps with version
146 engineConfig := &EngineConfig{
147 ID: "codex",
148 Version: "3.0.1",
149 }
150 workflowData := &WorkflowData{
151 EngineConfig: engineConfig,
152 }
153 stepsWithVersion := engine.GetInstallationSteps(workflowData)
154 foundVersionInstall := false
155 for _, step := range stepsWithVersion {
156 for _, line := range step {
157 if strings.Contains(line, "npm install") && strings.Contains(line, "@openai/codex@3.0.1") {
158 foundVersionInstall = true
159 break
160 }
161 }
162 }
163 if !foundVersionInstall {
164 t.Error("Expected versioned npm install command with @openai/codex@3.0.1")
165 }
166}
167
168func TestCodexEngineExecutionIncludesGitHubAWPrompt(t *testing.T) {
169 engine := NewCodexEngine()

Callers

nothing calls this directly

Calls 4

GetInstallationStepsMethod · 0.95
NewCodexEngineFunction · 0.85
ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected