27 lines
591 B
Go
27 lines
591 B
Go
package netreq
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"rhemawavetech.com/rhemawave/internal/db"
|
|
)
|
|
|
|
func TestGet(t *testing.T) {
|
|
url := "http://localhost:5173/api/v1/proclamations"
|
|
|
|
// Explicitly tell GetJSON to return a slice of db.Proclamation
|
|
proclamations, err := GetJSON[db.Proclamation](url)
|
|
|
|
if err != nil {
|
|
t.Fatalf("GetJSON failed: %v", err)
|
|
}
|
|
|
|
if len(proclamations) == 0 {
|
|
t.Fatal("GetJSON returned no records")
|
|
}
|
|
|
|
// You can now inspect the actual struct fields instead of raw strings
|
|
fmt.Printf("Fetched %d records. First ID: %s\n", len(proclamations), proclamations[0].ID)
|
|
}
|