(t *testing.T)
| 267 | } |
| 268 | |
| 269 | func TestValidateRuntimePackages(t *testing.T) { |
| 270 | tests := []struct { |
| 271 | name string |
| 272 | workflowData *WorkflowData |
| 273 | expectError bool |
| 274 | skipReason string |
| 275 | }{ |
| 276 | { |
| 277 | name: "no runtime packages", |
| 278 | workflowData: &WorkflowData{ |
| 279 | CustomSteps: "echo hello", |
| 280 | }, |
| 281 | expectError: false, |
| 282 | }, |
| 283 | { |
| 284 | name: "invalid mcp-scripts pip dependency name", |
| 285 | workflowData: &WorkflowData{ |
| 286 | MCPScripts: &MCPScriptsConfig{ |
| 287 | Tools: map[string]*MCPScriptToolConfig{ |
| 288 | "fetch-url": { |
| 289 | Name: "fetch-url", |
| 290 | Description: "Fetch URL", |
| 291 | Py: "print('ok')", |
| 292 | Dependencies: []string{"re quests"}, |
| 293 | }, |
| 294 | }, |
| 295 | }, |
| 296 | }, |
| 297 | expectError: true, |
| 298 | }, |
| 299 | { |
| 300 | name: "floating mcp-scripts pip dependency", |
| 301 | workflowData: &WorkflowData{ |
| 302 | MCPScripts: &MCPScriptsConfig{ |
| 303 | Tools: map[string]*MCPScriptToolConfig{ |
| 304 | "fetch-url": { |
| 305 | Name: "fetch-url", |
| 306 | Description: "Fetch URL", |
| 307 | Py: "print('ok')", |
| 308 | Dependencies: []string{"requests"}, |
| 309 | }, |
| 310 | }, |
| 311 | }, |
| 312 | }, |
| 313 | expectError: true, |
| 314 | }, |
| 315 | // Note: These tests would fail if npm/uv/pip are available, so we skip them |
| 316 | // The actual validation logic is tested by the extraction tests |
| 317 | } |
| 318 | |
| 319 | for _, tt := range tests { |
| 320 | t.Run(tt.name, func(t *testing.T) { |
| 321 | compiler := NewCompiler() |
| 322 | err := compiler.validateRuntimePackages(tt.workflowData) |
| 323 | |
| 324 | // If we expect an error and got one, or don't expect one and didn't get one, test passes |
| 325 | if tt.expectError && err == nil { |
| 326 | t.Error("expected error but got none") |
nothing calls this directly
no test coverage detected