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

Function TestIsMCPScriptsEnabled

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

Source from the content-addressed store, hash-verified

45}
46
47func TestIsMCPScriptsEnabled(t *testing.T) {
48 // Test config with tools
49 configWithTools := &MCPScriptsConfig{
50 Tools: map[string]*MCPScriptToolConfig{
51 "test": {Name: "test", Description: "Test tool"},
52 },
53 }
54
55 tests := []struct {
56 name string
57 config *MCPScriptsConfig
58 expected bool
59 }{
60 {
61 name: "nil config - not enabled",
62 config: nil,
63 expected: false,
64 },
65 {
66 name: "empty tools - not enabled",
67 config: &MCPScriptsConfig{Tools: map[string]*MCPScriptToolConfig{}},
68 expected: false,
69 },
70 {
71 name: "with tools - enabled by default",
72 config: configWithTools,
73 expected: true,
74 },
75 {
76 name: "with tools and feature flag enabled - enabled (backward compat)",
77 config: configWithTools,
78 expected: true,
79 },
80 {
81 name: "with tools and feature flag disabled - still enabled (feature flag ignored)",
82 config: configWithTools,
83 expected: true,
84 },
85 {
86 name: "with tools and other features - enabled",
87 config: configWithTools,
88 expected: true,
89 },
90 }
91
92 for _, tt := range tests {
93 t.Run(tt.name, func(t *testing.T) {
94 result := IsMCPScriptsEnabled(tt.config)
95 if result != tt.expected {
96 t.Errorf("Expected %v, got %v", tt.expected, result)
97 }
98 })
99 }
100}
101
102func TestIsMCPScriptsEnabledWithEnv(t *testing.T) {
103 // Test config with tools

Callers

nothing calls this directly

Calls 3

IsMCPScriptsEnabledFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected