MCPcopy Index your code
hub / github.com/github/gh-aw / TestCodexEngineGitHubToolsetsRendering

Function TestCodexEngineGitHubToolsetsRendering

pkg/workflow/github_toolset_test.go:241–318  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

239}
240
241func TestCodexEngineGitHubToolsetsRendering(t *testing.T) {
242 tests := []struct {
243 name string
244 githubTool map[string]any
245 expectedInYAML []string
246 notInYAML []string
247 }{
248 {
249 name: "Toolsets configured with array",
250 githubTool: map[string]any{
251 "toolsets": []string{"repos", "issues"},
252 },
253 expectedInYAML: []string{
254 `"GITHUB_TOOLSETS" = "repos,issues"`,
255 },
256 notInYAML: []string{},
257 },
258 {
259 name: "No toolsets configured",
260 githubTool: map[string]any{},
261 expectedInYAML: []string{
262 `GITHUB_PERSONAL_ACCESS_TOKEN`,
263 "GITHUB_TOOLSETS",
264 "context,repos,issues,pull_requests", // defaults to action-friendly toolsets
265 },
266 notInYAML: []string{},
267 },
268 {
269 name: "Default toolset as array - expands to action-friendly",
270 githubTool: map[string]any{
271 "toolsets": []string{"default"},
272 },
273 expectedInYAML: []string{
274 `"GITHUB_TOOLSETS" = "context,repos,issues,pull_requests"`,
275 },
276 notInYAML: []string{},
277 },
278 {
279 name: "Default with additional toolsets - expands default",
280 githubTool: map[string]any{
281 "toolsets": []string{"default", "discussions"},
282 },
283 expectedInYAML: []string{
284 `"GITHUB_TOOLSETS" = "context,repos,issues,pull_requests,discussions"`,
285 },
286 notInYAML: []string{},
287 },
288 }
289
290 for _, tt := range tests {
291 t.Run(tt.name, func(t *testing.T) {
292 // Use unified renderer with Codex engine options
293 renderer := NewMCPConfigRenderer(MCPRendererOptions{
294 IncludeCopilotFields: false,
295 InlineArgs: false,
296 Format: "toml",
297 IsLast: false,
298 })

Callers

nothing calls this directly

Calls 5

NewMCPConfigRendererFunction · 0.85
RenderGitHubMCPMethod · 0.80
RunMethod · 0.45
StringMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected