Files
Florian-netz/vitest.setup.ts
Claude 38021cbc51 db: DATABASE_URL-Schema auf postgresql:// (wie feuerwehr_dashboard)
Dashboard nutzt das Format postgresql://USER:PASS@HOST:PORT/DB. Angeglichen in
docker-compose.yml, .env.example (+ Host-Hinweis lokal=localhost / Container=postgres),
vitest.setup.ts und env.test.ts. Funktional identisch (pg/Drizzle akzeptieren beide),
aber konsistent mit dem bestehenden Setup.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 12:47:46 +02:00

18 lines
735 B
TypeScript

// Vitest-Setup: stellt Test-Env bereit, damit Module, die `@/lib/env` bzw.
// `@/db` importieren, beim Laden nicht an der Env-Validierung scheitern.
// Es wird KEINE echte DB-Verbindung geöffnet (Pool ist lazy bis zur Query).
const TEST_ENV: Record<string, string> = {
NODE_ENV: "test",
DATABASE_URL: "postgresql://test:test@localhost:5432/test",
AUTH_SECRET: "test-secret-mindestens-32-zeichen-lang-xxxx",
AUTH_URL: "http://localhost:3000",
AUTH_TRUST_HOST: "true",
AUTHENTIK_ISSUER: "http://localhost:9000/application/o/floriannetz/",
AUTHENTIK_CLIENT_ID: "floriannetz",
AUTHENTIK_CLIENT_SECRET: "test",
};
for (const [k, v] of Object.entries(TEST_ENV)) {
if (process.env[k] === undefined) process.env[k] = v;
}