teqo-backup/vitest.setup.ts
Francisco Ignácio Fontoura Solla aa12e173d8 Ship A10 vote estimate scenarios (pessimistic/central/optimistic) for Praças.
Staff surfaces share one Cenário control; leaders keep a single declaredVotes value. Unlocks E8.
2026-07-23 19:12:22 -03:00

16 lines
719 B
TypeScript

// Load the isolated test environment — NEVER .env / .env.local, which point at
// the production database. `override: true` guarantees the test database wins
// even if a prod DATABASE_URL is already exported in the shell.
import { config as loadEnv } from 'dotenv'
import { assertTestDatabase } from './tests/helpers/assertTestDatabase'
loadEnv({ path: '.env.test', override: true })
// Optional local override when the default Docker port is occupied (e.g. mapped to 5433).
if (process.env.TEQO_TEST_DATABASE_URL) {
process.env.DATABASE_URL = process.env.TEQO_TEST_DATABASE_URL
}
// Fail closed: refuse to run the (destructive) suite against a non-test database.
assertTestDatabase(process.env.DATABASE_URL)