(t *testing.T)
| 77 | } |
| 78 | |
| 79 | func TestNodeJSRuntime_Execute(t *testing.T) { |
| 80 | runtime := NewNodeJSRuntime(nil) |
| 81 | |
| 82 | if !runtime.IsAvailable() { |
| 83 | t.Skip("Node.js not available") |
| 84 | } |
| 85 | |
| 86 | ctx := context.Background() |
| 87 | code := ` |
| 88 | const result = _input.a + _input.b; |
| 89 | console.log(result); |
| 90 | ` |
| 91 | input := map[string]any{ |
| 92 | "a": 10, |
| 93 | "b": 20, |
| 94 | } |
| 95 | |
| 96 | result, err := runtime.Execute(ctx, code, input) |
| 97 | if err != nil { |
| 98 | t.Fatalf("Execute failed: %v", err) |
| 99 | } |
| 100 | |
| 101 | if !result.Success { |
| 102 | t.Errorf("expected success, got error: %s", result.Error) |
| 103 | } |
| 104 | |
| 105 | if result.Output != "30" { |
| 106 | t.Errorf("expected output '30', got %v", result.Output) |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | func TestBashRuntime_Execute(t *testing.T) { |
| 111 | runtime := NewBashRuntime(nil) |
nothing calls this directly
no test coverage detected