This commit is contained in:
2026-01-28 12:43:17 -05:00
parent f9d3753806
commit 604178341d
10 changed files with 188 additions and 172 deletions

View File

@@ -2,6 +2,7 @@ package runtime
import (
"bytes"
"context"
"strings"
"testing"
@@ -14,8 +15,10 @@ import (
func TestExecuteTypeScript(t *testing.T) {
var stdout, stderr bytes.Buffer
rt := New()
err := rt.RunFile("../../test_data/test.ts", &stdout, &stderr)
rt, err := New(context.Background())
assert.NoError(t, err, "Expected no error")
err = rt.RunFile("../../test_data/test.ts", &stdout, &stderr)
assert.NoError(t, err, "Expected no error")
assert.Empty(t, stderr.String(), "Expected no error output")
@@ -32,7 +35,8 @@ func TestExecuteTypeScript(t *testing.T) {
}
func TestFetchBuiltinIntegration(t *testing.T) {
rt := New()
rt, err := New(context.Background())
assert.NoError(t, err, "Expected no error")
tsContent := `
const result = add({a: 5, b: 10});
@@ -40,7 +44,7 @@ func TestFetchBuiltinIntegration(t *testing.T) {
`
var stdout, stderr bytes.Buffer
err := rt.RunCode(tsContent, &stdout, &stderr)
err = rt.RunCode(tsContent, &stdout, &stderr)
require.NoError(t, err)
assert.Contains(t, stdout.String(), "Result:")
}