Rollen Chunk 5b: Auth-Routen initialisieren frische Datenbanken
Docker Image / test (push) Canceled after 0s
Docker Image / image (push) Canceled after 0s

This commit is contained in:
loki committed 2026-10-11 19:37:40 +02:00
1 parent 6133dd9089
commit ccb71ea5d8
1 file changed
+29
+29
View File
@@ -139,3 +139,32 @@ describe("Benutzerkonto (Chunk 4)", () => {
expect(row?.email).toBe("neu@example.org");
});
});
describe("frische Datenbank (Chunk 5)", () => {
test("Erstanlage ohne vorheriges Setup", async () => {
const { mkdtempSync, rmSync } = await import("node:fs");
const { tmpdir } = await import("node:os");
const { join } = await import("node:path");
const { closeDb } = await import("@/lib/db");
const dir = mkdtempSync(join(tmpdir(), "muz-frisch-"));
closeDb();
process.env.DATA_DIR = dir;
try {
const response = await POST(
new Request("http://localhost/api/auth/sign-up/email", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
name: "Frisch",
email: "frisch@example.org",
password: "geheim-geheim!",
}),
}),
);
expect(response.status).toBe(200);
} finally {
closeDb();
rmSync(dir, { recursive: true, force: true });
}
});
});