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

Function TestIsMCPScriptsEnabledWithEnv

pkg/workflow/mcp_scripts_parser_test.go:102–126  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

100}
101
102func TestIsMCPScriptsEnabledWithEnv(t *testing.T) {
103 // Test config with tools
104 configWithTools := &MCPScriptsConfig{
105 Tools: map[string]*MCPScriptToolConfig{
106 "test": {Name: "test", Description: "Test tool"},
107 },
108 }
109
110 // MCP Scripts are enabled by default when configured, environment variable no longer needed
111 t.Run("with tools - enabled regardless of GH_AW_FEATURES", func(t *testing.T) {
112 t.Setenv("GH_AW_FEATURES", "mcp-scripts")
113 result := IsMCPScriptsEnabled(configWithTools)
114 if !result {
115 t.Errorf("Expected true, got false")
116 }
117 })
118
119 t.Run("with tools and GH_AW_FEATURES=other - still enabled", func(t *testing.T) {
120 t.Setenv("GH_AW_FEATURES", "other")
121 result := IsMCPScriptsEnabled(configWithTools)
122 if !result {
123 t.Errorf("Expected true, got false")
124 }
125 })
126}
127
128// TestParseMCPScriptsAndExtractMCPScriptsConfigConsistency verifies that ParseMCPScripts
129// and extractMCPScriptsConfig produce identical results for the same input.

Callers

nothing calls this directly

Calls 4

IsMCPScriptsEnabledFunction · 0.85
SetenvMethod · 0.80
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected