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

Function TestGenerateGeminiSettingsStep

pkg/workflow/gemini_engine_test.go:482–602  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

480}
481
482func TestGenerateGeminiSettingsStep(t *testing.T) {
483 engine := NewGeminiEngine()
484
485 t.Run("step sets context.includeDirectories to /tmp/", func(t *testing.T) {
486 workflowData := &WorkflowData{
487 Name: "test-workflow",
488 Tools: map[string]any{},
489 }
490 step := engine.generateGeminiSettingsStep(workflowData)
491 content := strings.Join(step, "\n")
492
493 assert.Contains(t, content, "Write Gemini Config", "Should have correct step name")
494 assert.Contains(t, content, "/tmp/", "Should include /tmp/ in include directories")
495 assert.Contains(t, content, "includeDirectories", "Should set includeDirectories")
496 assert.Contains(t, content, ".gemini", "Should reference .gemini directory")
497 assert.Contains(t, content, "GITHUB_WORKSPACE", "Should use GITHUB_WORKSPACE")
498 })
499
500 t.Run("step includes merge logic for existing settings.json", func(t *testing.T) {
501 workflowData := &WorkflowData{
502 Name: "test-workflow",
503 Tools: map[string]any{},
504 }
505 step := engine.generateGeminiSettingsStep(workflowData)
506 content := strings.Join(step, "\n")
507
508 assert.Contains(t, content, "if [ -f", "Should check for existing settings.json")
509 assert.Contains(t, content, "jq", "Should use jq for merging")
510 assert.Contains(t, content, "$existing * $base", "Should merge with base taking precedence")
511 })
512
513 t.Run("step includes tools.core with bash mapping", func(t *testing.T) {
514 workflowData := &WorkflowData{
515 Name: "test-workflow",
516 Tools: map[string]any{
517 "bash": []any{"grep", "git"},
518 },
519 }
520 step := engine.generateGeminiSettingsStep(workflowData)
521 content := strings.Join(step, "\n")
522
523 assert.Contains(t, content, "run_shell_command(grep)", "Should include run_shell_command(grep) for bash grep")
524 assert.Contains(t, content, "run_shell_command(git)", "Should include run_shell_command(git) for bash git")
525 assert.Contains(t, content, "core", "Should include tools.core")
526 })
527
528 t.Run("step includes tools.core with edit mapping", func(t *testing.T) {
529 workflowData := &WorkflowData{
530 Name: "test-workflow",
531 Tools: map[string]any{
532 "edit": map[string]any{},
533 },
534 }
535 step := engine.generateGeminiSettingsStep(workflowData)
536 content := strings.Join(step, "\n")
537
538 assert.Contains(t, content, "write_file", "Should include write_file for edit tool")
539 assert.Contains(t, content, "replace", "Should include replace for edit tool")

Callers

nothing calls this directly

Calls 3

NewGeminiEngineFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected