Skip to content

Commit

Permalink
add tests in golang
Browse files Browse the repository at this point in the history
  • Loading branch information
jairad26 committed Jan 12, 2025
1 parent e973071 commit 470aca5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sdk/go/pkg/neo4j/neo4j_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,25 @@ var (
hostName = "myneo4j"
)

func TestRecordJSONMarshal(t *testing.T) {
record := neo4j.Record{
Keys: []string{"name", "age", "friends"},
Values: []string{`"Alice"`, `"42"`, `["Bob","Peter","Anna"]`},
}

// Marshal the record to JSON
jsonBytes, err := record.JSONMarshal()
if err != nil {
t.Fatalf("Expected no error, but received: %v", err)
}

jsonStr := string(jsonBytes)
expectedJSONStr := `{"name":"Alice","age":"42","friends":["Bob","Peter","Anna"]}`
if jsonStr != expectedJSONStr {
t.Errorf("Expected JSON: %s, but received: %s", expectedJSONStr, jsonStr)
}
}

func TestExecuteQuery(t *testing.T) {
dbName := "mydb"
query := "query"
Expand Down

0 comments on commit 470aca5

Please sign in to comment.