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

Function TestClaudeEngine

pkg/workflow/claude_engine_test.go:15–152  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestClaudeEngine(t *testing.T) {
16 engine := NewClaudeEngine()
17
18 // Test basic properties
19 if engine.GetID() != "claude" {
20 t.Errorf("Expected ID 'claude', got '%s'", engine.GetID())
21 }
22
23 if engine.GetDisplayName() != "Claude Code" {
24 t.Errorf("Expected display name 'Claude Code', got '%s'", engine.GetDisplayName())
25 }
26
27 if engine.GetDescription() != "Uses Claude Code with full MCP tool support and allow-listing" {
28 t.Errorf("Expected description 'Uses Claude Code with full MCP tool support and allow-listing', got '%s'", engine.GetDescription())
29 }
30
31 if engine.IsExperimental() {
32 t.Error("Claude engine should not be experimental")
33 }
34
35 if !engine.GetCapabilities().ToolsAllowlist {
36 t.Error("Claude engine should support MCP tools")
37 }
38
39 // Test installation steps (should have 2 steps: Node.js setup + install;
40 // secret validation is now in the activation job via GetSecretValidationStep)
41 installSteps := engine.GetInstallationSteps(&WorkflowData{})
42 if len(installSteps) != 2 {
43 t.Errorf("Expected 2 installation steps for Claude (Node.js setup + install), got %d", len(installSteps))
44 }
45
46 // Check for Node.js setup step
47 nodeSetupStep := strings.Join([]string(installSteps[0]), "\n")
48 if !strings.Contains(nodeSetupStep, "Setup Node.js") {
49 t.Errorf("Expected 'Setup Node.js' in first installation step, got: %s", nodeSetupStep)
50 }
51 if !strings.Contains(nodeSetupStep, "node-version: '24'") {
52 t.Errorf("Expected 'node-version: '24'' in Node.js setup step, got: %s", nodeSetupStep)
53 }
54
55 // Check for install step
56 installStep := strings.Join([]string(installSteps[1]), "\n")
57 if !strings.Contains(installStep, "Install Claude Code CLI") {
58 t.Errorf("Expected 'Install Claude Code CLI' in installation step, got: %s", installStep)
59 }
60 expectedInstallCommand := fmt.Sprintf("npm install -g @anthropic-ai/claude-code@%s", constants.DefaultClaudeCodeVersion)
61 if !strings.Contains(installStep, expectedInstallCommand) {
62 t.Errorf("Expected '%s' in install step, got: %s", expectedInstallCommand, installStep)
63 }
64 if strings.Contains(installStep, "--ignore-scripts") {
65 t.Errorf("Expected no --ignore-scripts flag for Claude Code (requires post-install scripts), got: %s", installStep)
66 }
67 if strings.Contains(installStep, "NPM_CONFIG_MIN_RELEASE_AGE") {
68 t.Errorf("Expected no npm release-age cooldown env for Claude install, got: %s", installStep)
69 }
70
71 // Test execution steps
72 workflowData := &WorkflowData{

Callers

nothing calls this directly

Calls 10

GetInstallationStepsMethod · 0.95
GetExecutionStepsMethod · 0.95
NewClaudeEngineFunction · 0.85
GetIDMethod · 0.65
GetDisplayNameMethod · 0.65
GetDescriptionMethod · 0.65
IsExperimentalMethod · 0.65
GetCapabilitiesMethod · 0.65
ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected