Checkpoint: Correctif de première installation : après les migrations Drizzle, le serveur crée le compte administrateur Itinova requis avec mot de passe haché, sans doublon. Validation complète réussie : 62 tests, TypeScript et build.
All checks were successful
Validation applicative / TypeScript, tests et build (push) Successful in 1h3m35s
All checks were successful
Validation applicative / TypeScript, tests et build (push) Successful in 1h3m35s
This commit is contained in:
14
server/initialAdminBootstrap.test.ts
Normal file
14
server/initialAdminBootstrap.test.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("bootstrap du compte administrateur", () => {
|
||||
it("crée le compte administrateur requis après migration sans stocker de mot de passe en clair", async () => {
|
||||
const bootstrap = await readFile(resolve(process.cwd(), "server/databaseMigrations.ts"), "utf8");
|
||||
|
||||
expect(bootstrap).toContain('const INITIAL_ADMIN_LOGIN = "adminItinova"');
|
||||
expect(bootstrap).toContain("await ensureInitialAdmin(pool)");
|
||||
expect(bootstrap).toContain("await bcrypt.hash(INITIAL_ADMIN_PASSWORD");
|
||||
expect(bootstrap).not.toContain("passwordHash: INITIAL_ADMIN_PASSWORD,");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user