Initial commit
CI / test (push) Canceled after 0s

This commit is contained in:
2026-09-12 22:22:17 +02:00
commit 904d14b64c
314 changed files with 31884 additions and 0 deletions
@@ -0,0 +1,35 @@
package postgres
import (
"database/sql"
"os"
"testing"
)
func TestSpeciesModelListsSeededGlobalSpecies(t *testing.T) {
dsn := os.Getenv("GARDOMATIC_TEST_DB_DSN")
if dsn == "" {
t.Skip("set GARDOMATIC_TEST_DB_DSN to run PostgreSQL integration tests")
}
db, err := sql.Open("postgres", dsn)
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { _ = db.Close() })
if err := db.Ping(); err != nil {
t.Fatalf("connect to PostgreSQL: %v", err)
}
species, err := (SpeciesModel{DB: db}).GetAllForGarden(2_147_483_647)
if err != nil {
t.Fatalf("list global species: %v", err)
}
for _, item := range species {
if item.GardenID == nil && item.CommonName == "Tomate" {
return
}
}
t.Fatal("seeded global species Tomate was not returned")
}