(t *testing.T)
| 918 | } |
| 919 | |
| 920 | func TestClaudeEngineWithExpressionVersion(t *testing.T) { |
| 921 | engine := NewClaudeEngine() |
| 922 | |
| 923 | expressionVersion := "${{ inputs.engine-version }}" |
| 924 | workflowData := &WorkflowData{ |
| 925 | Name: "test-workflow", |
| 926 | EngineConfig: &EngineConfig{ |
| 927 | ID: "claude", |
| 928 | Version: expressionVersion, |
| 929 | }, |
| 930 | } |
| 931 | |
| 932 | // Expression version must use env var injection in the install step |
| 933 | installSteps := engine.GetInstallationSteps(workflowData) |
| 934 | // Expect: Node.js setup step + install step |
| 935 | if len(installSteps) != 2 { |
| 936 | t.Fatalf("Expected 2 installation steps, got %d", len(installSteps)) |
| 937 | } |
| 938 | |
| 939 | installStep := strings.Join([]string(installSteps[1]), "\n") |
| 940 | |
| 941 | // Should use ENGINE_VERSION env var |
| 942 | if !strings.Contains(installStep, "ENGINE_VERSION: "+expressionVersion) { |
| 943 | t.Errorf("Expected ENGINE_VERSION env var in install step, got:\n%s", installStep) |
| 944 | } |
| 945 | |
| 946 | // Should reference env var in command |
| 947 | if !strings.Contains(installStep, `"${ENGINE_VERSION}"`) { |
| 948 | t.Errorf(`Expected "$ENGINE_VERSION" in npm install command, got:\n%s`, installStep) |
| 949 | } |
| 950 | |
| 951 | // Should NOT embed expression directly in shell command |
| 952 | if strings.Contains(installStep, "@anthropic-ai/claude-code@"+expressionVersion) { |
| 953 | t.Errorf("Expression should NOT be embedded directly in npm install command, got:\n%s", installStep) |
| 954 | } |
| 955 | } |
| 956 | |
| 957 | func TestIsAnthropicWIF(t *testing.T) { |
| 958 | tests := []struct { |
nothing calls this directly
no test coverage detected