diff --git a/drizzle.config.ts b/drizzle.config.ts index 27c4a86..aa57f48 100644 --- a/drizzle.config.ts +++ b/drizzle.config.ts @@ -2,7 +2,9 @@ import { defineConfig } from "drizzle-kit"; import process from "node:process"; const url = process.env.DATABASE_URL ?? - `postgresql://${process.env.POSTGRES_USER}:${process.env.POSTGRES_PASS}@${process.env.POSTGRES_HOST ?? "localhost"}:${process.env.POSTGRES_PORT ?? 5432}/${process.env.POSTGRES_DB}`; + `postgresql://${process.env.POSTGRES_USER}:${process.env.POSTGRES_PASS}@${ + process.env.POSTGRES_HOST ?? "localhost" + }:${process.env.POSTGRES_PORT ?? 5432}/${process.env.POSTGRES_DB}`; export default defineConfig({ dialect: "postgresql", diff --git a/tests/e2e/roles_test.ts b/tests/e2e/roles_test.ts index 5decace..8026434 100644 --- a/tests/e2e/roles_test.ts +++ b/tests/e2e/roles_test.ts @@ -18,7 +18,10 @@ Deno.test({ async fn() { await truncateAll(); await seedRoles([{ nom: "admin" }, { nom: "employee" }]); - const res = await rolesHandler.GET!(makeGetRequest("/roles"), makeEmployeeContext()); + const res = await rolesHandler.GET!( + makeGetRequest("/roles"), + makeEmployeeContext(), + ); assertEquals(res.status, 200); const body = await res.json(); assertEquals(body.length, 2); diff --git a/tests/integration/roles_test.ts b/tests/integration/roles_test.ts index c7c4307..9fb7a6c 100644 --- a/tests/integration/roles_test.ts +++ b/tests/integration/roles_test.ts @@ -21,7 +21,8 @@ Deno.test({ name: "integration roles: create and retrieve by id", async fn() { await truncateAll(); - const [created] = await testDb.insert(roles).values({ nom: "viewer" }).returning(); + const [created] = await testDb.insert(roles).values({ nom: "viewer" }) + .returning(); assertExists(created.id); assertEquals(created.nom, "viewer"); const row = await testDb @@ -87,7 +88,9 @@ Deno.test({ { idRole: role.id, idPermission: "note_read" }, ]); // reset - await testDb.delete(rolePermissions).where(eq(rolePermissions.idRole, role.id)); + await testDb.delete(rolePermissions).where( + eq(rolePermissions.idRole, role.id), + ); await testDb.insert(rolePermissions).values([ { idRole: role.id, idPermission: "note_write" }, ]); diff --git a/tests/unit/roles_test.ts b/tests/unit/roles_test.ts index 7cca58d..eeae55e 100644 --- a/tests/unit/roles_test.ts +++ b/tests/unit/roles_test.ts @@ -58,7 +58,9 @@ Deno.test("mock API: GET /roles/:id returns role", async () => { }); Deno.test("mock API: GET /roles/:id 404 when not found", async () => { - mockFetch({ "/roles/99": { status: 404, body: { error: "Ressource introuvable" } } }); + mockFetch({ + "/roles/99": { status: 404, body: { error: "Ressource introuvable" } }, + }); try { const res = await fetch("http://localhost/api/roles/99"); assertEquals(res.status, 404); @@ -120,7 +122,9 @@ Deno.test("mock API: PUT /roles/:id updates role and permissions", async () => { Deno.test("mock API: DELETE /roles/:id returns 204", async () => { mockFetch({ "/roles/2": { method: "DELETE", status: 204 } }); try { - const res = await fetch("http://localhost/api/roles/2", { method: "DELETE" }); + const res = await fetch("http://localhost/api/roles/2", { + method: "DELETE", + }); assertEquals(res.status, 204); } finally { restoreFetch();