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

Function TestGeminiEngineWithExpressionVersion

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

Source from the content-addressed store, hash-verified

602}
603
604func TestGeminiEngineWithExpressionVersion(t *testing.T) {
605 engine := NewGeminiEngine()
606
607 expressionVersion := "${{ inputs.engine-version }}"
608 workflowData := &WorkflowData{
609 Name: "test-workflow",
610 EngineConfig: &EngineConfig{
611 ID: "gemini",
612 Version: expressionVersion,
613 },
614 }
615
616 installSteps := engine.GetInstallationSteps(workflowData)
617
618 // Find the npm install step
619 var installStep string
620 for _, step := range installSteps {
621 stepContent := strings.Join([]string(step), "\n")
622 if strings.Contains(stepContent, "npm install") {
623 installStep = stepContent
624 break
625 }
626 }
627
628 if installStep == "" {
629 t.Fatal("Could not find npm install step")
630 }
631
632 // Should use ENGINE_VERSION env var for injection safety
633 if !strings.Contains(installStep, "ENGINE_VERSION: "+expressionVersion) {
634 t.Errorf("Expected ENGINE_VERSION env var in install step, got:\n%s", installStep)
635 }
636
637 // Should reference env var in command
638 if !strings.Contains(installStep, `"${ENGINE_VERSION}"`) {
639 t.Errorf(`Expected "$ENGINE_VERSION" in npm install command, got:\n%s`, installStep)
640 }
641
642 // Should NOT embed expression directly in npm install command
643 if strings.Contains(installStep, "@google/gemini-cli@"+expressionVersion) {
644 t.Errorf("Expression should NOT be embedded directly in npm install command, got:\n%s", installStep)
645 }
646}

Callers

nothing calls this directly

Calls 3

GetInstallationStepsMethod · 0.95
NewGeminiEngineFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected