docs(core): say which database the tests actually need

The helper told you to use "an isolated database for tests", which reads
as a database of its own and is not what the suite wants. Route tests
reach the database through the app and core tests reach it directly, so
two different values put the fixtures in one database and the assertions
in the other — around forty failures, none of them in the code that
caused it, and nothing in the output naming the setting.

Also drops a type import nothing uses.
This commit is contained in:
Wanjohi
2026-09-05 18:07:41 +03:00
parent b296918ab4
commit dae2990cbe
2 changed files with 9 additions and 4 deletions

View File

@@ -3,11 +3,17 @@ import postgres from 'postgres';
/**
* Fail-closed test database connection.
*
* Tests must never silently fall back to an ad-hoc localhost database, so
* this throws unless an explicit `TEST_DATABASE_URL` is set. Use an isolated
* database for tests, e.g.:
* Tests must never silently fall back to an ad-hoc localhost database, so this
* throws unless an explicit `TEST_DATABASE_URL` is set. Use a database you do
* not mind losing, migrated fresh:
*
* TEST_DATABASE_URL=postgres://postgres:postgres@localhost:5432/nestri
*
* **The same database `DATABASE_URL` names, not a second one.** Route tests
* reach the database through the app, which reads `DATABASE_URL`; core tests
* reach it through here. Two different values put the fixtures in one database
* and the assertions in the other, and the suite then fails in neither half's
* own code with nothing in the output naming the cause.
*/
export function testDb() {
const url = process.env.TEST_DATABASE_URL;