fix(api): la garde resetDatabase() accepte aussi la base CI
DATABASE_URL en CI (ci.yml) pointe vers "batchcooking_ci", pas
"batchcooking_test" — la garde ne cherchait que "test" et rejetait donc
la base CI légitime, faisant échouer les 282 tests. Accepte "test" ou
"ci" désormais ; seul le nom réel de la base de dev ("batchcooking")
ne matche toujours ni l'un ni l'autre, ce qui reste le seul cas que
cette garde doit effectivement bloquer.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
61ac2993db
commit
17b6b9151a
1 changed files with 7 additions and 2 deletions
|
|
@ -18,9 +18,14 @@ function assertRunningAgainstTestDatabase() {
|
||||||
`resetDatabase() TRUNCATEs almost the whole schema — refusing to run outside NODE_ENV=test (currently "${env.NODE_ENV}").`,
|
`resetDatabase() TRUNCATEs almost the whole schema — refusing to run outside NODE_ENV=test (currently "${env.NODE_ENV}").`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!env.DATABASE_URL?.includes("test")) {
|
// "test" covers a local `.env.test` (`batchcooking_test`); "ci" covers
|
||||||
|
// CI's own service database (`batchcooking_ci`, set directly via the
|
||||||
|
// workflow's `env:`, not a `.env.test` file — see ci.yml). Neither
|
||||||
|
// matches the real dev database's name (`batchcooking`), which is the
|
||||||
|
// one case this must actually catch.
|
||||||
|
if (!env.DATABASE_URL?.includes("test") && !env.DATABASE_URL?.includes("ci")) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`resetDatabase() refuses to run against a DATABASE_URL that doesn't look like a test database (got "${env.DATABASE_URL}", expected it to contain "test") — see .env.test.example.`,
|
`resetDatabase() refuses to run against a DATABASE_URL that doesn't look like a test database (got "${env.DATABASE_URL}", expected it to contain "test" or "ci") — see .env.test.example.`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue