Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions sdk/tests/cmd/datastar-sdk-tests/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

func main() {
var (
serverURL = flag.String("server", "http://localhost:7331", "Test server URL")
verbose = flag.Bool("v", false, "Verbose output")
testType = flag.String("type", "all", "Test type: get, post, or all")
help = flag.Bool("h", false, "Show help")
Expand All @@ -31,9 +30,6 @@ func main() {
os.Exit(0)
}

// Set environment variable for tests
os.Setenv("TEST_SERVER_URL", *serverURL)

// Create a testing.M to run tests
var tests []testing.InternalTest

Expand Down
12 changes: 6 additions & 6 deletions sdk/tests/testdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ package sdktests
import (
"bytes"
"embed"
"flag"
"fmt"
"io"
"io/fs"
"net/http"
"net/url"
"os"
"path"
"path/filepath"
"sort"
"strings"
Expand All @@ -23,12 +25,10 @@ import (
//go:embed golden
var testData embed.FS

var serverURL = os.Getenv("TEST_SERVER_URL")
var serverURL string

func init() {
if serverURL == "" {
serverURL = "http://localhost:7331"
}
flag.StringVar(&serverURL, "server", "http://localhost:7331", "Test server URL")
}

// TestSSEGetEndpoints is an exported version of the GET endpoint tests
Expand Down Expand Up @@ -64,8 +64,8 @@ func runTestCases(t *testing.T, embedFS embed.FS, casesDir string, runTest func(
for testName := range testCases {
testName := testName // capture for closure
t.Run(testName, func(t *testing.T) {
inputPath := filepath.Join(casesDir, testName, "input.json")
outputPath := filepath.Join(casesDir, testName, "output.txt")
inputPath := path.Join(casesDir, testName, "input.json")
outputPath := path.Join(casesDir, testName, "output.txt")

// Read input from embedded FS
inputData, err := embedFS.ReadFile(inputPath)
Expand Down