test(infra): add postgres and frontend test tooling

Add repeatable PostgreSQL integration tests and configure Vitest, Testing Library, and ESLint.

Refs #11

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 19:54:28 +01:00
parent a4d63015d4
commit 9970b49746
8 changed files with 1865 additions and 26 deletions

View File

@ -0,0 +1,21 @@
package api_test
import (
"os"
"testing"
)
// postgresTestURL allows ordinary unit-test runs to skip integration cases,
// while making an explicitly requested PostgreSQL run fail if its harness did
// not provide a database URL.
func postgresTestURL(t *testing.T) string {
t.Helper()
if dsn := os.Getenv("TEST_DATABASE_URL"); dsn != "" {
return dsn
}
if os.Getenv("TEST_DATABASE_REQUIRED") == "1" {
t.Fatal("TEST_DATABASE_REQUIRED=1 but TEST_DATABASE_URL is empty")
}
t.Skip("TEST_DATABASE_URL absent: isolated PostgreSQL required")
return ""
}