From cd5c524ff0426b31fa75db3c3c3a5ba63ce9674f Mon Sep 17 00:00:00 2001 From: Djalim Simaila Date: Sun, 26 Apr 2026 14:18:09 +0200 Subject: [PATCH] style: fix deno fmt on students tests and drizzle.config --- drizzle.config.ts | 4 +++- tests/e2e/students_test.ts | 5 ++++- tests/unit/students_test.ts | 23 +++++++++++++++++++---- 3 files changed, 26 insertions(+), 6 deletions(-) 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/students_test.ts b/tests/e2e/students_test.ts index 07de874..e02103f 100644 --- a/tests/e2e/students_test.ts +++ b/tests/e2e/students_test.ts @@ -80,7 +80,10 @@ Deno.test({ assertEquals(res.status, 200); const body = await res.json(); assertEquals(body.length, 2); - assertEquals(body.every((s: { idPromo: string }) => s.idPromo === "PEIP1-2024"), true); + assertEquals( + body.every((s: { idPromo: string }) => s.idPromo === "PEIP1-2024"), + true, + ); }, sanitizeResources: false, sanitizeOps: false, diff --git a/tests/unit/students_test.ts b/tests/unit/students_test.ts index 2b51029..ded2ff2 100644 --- a/tests/unit/students_test.ts +++ b/tests/unit/students_test.ts @@ -65,7 +65,12 @@ Deno.test("mock API: GET /students/:numEtud returns one student", async () => { }); Deno.test("mock API: GET /students/:numEtud 404 when not found", async () => { - mockFetch({ "/students/99999": { status: 404, body: { error: "Ressource introuvable" } } }); + mockFetch({ + "/students/99999": { + status: 404, + body: { error: "Ressource introuvable" }, + }, + }); try { const res = await fetch("http://localhost/api/students/99999"); assertEquals(res.status, 404); @@ -81,7 +86,11 @@ Deno.test("mock API: POST /students creates student", async () => { const res = await fetch("http://localhost/api/students", { method: "POST", headers: { "content-type": "application/json" }, - body: JSON.stringify({ nom: "Dupont", prenom: "Jean", idPromo: "4AFISE25/26" }), + body: JSON.stringify({ + nom: "Dupont", + prenom: "Jean", + idPromo: "4AFISE25/26", + }), }); assertEquals(res.status, 201); const data: Student = await res.json(); @@ -93,12 +102,18 @@ Deno.test("mock API: POST /students creates student", async () => { Deno.test("mock API: PUT /students/:numEtud updates student", async () => { const updated = { ...students[0], nom: "Dupont-Modifié" }; - mockFetch({ "/students/21212006": { method: "PUT", status: 200, body: updated } }); + mockFetch({ + "/students/21212006": { method: "PUT", status: 200, body: updated }, + }); try { const res = await fetch("http://localhost/api/students/21212006", { method: "PUT", headers: { "content-type": "application/json" }, - body: JSON.stringify({ nom: "Dupont-Modifié", prenom: "Jean", idPromo: "4AFISE25/26" }), + body: JSON.stringify({ + nom: "Dupont-Modifié", + prenom: "Jean", + idPromo: "4AFISE25/26", + }), }); assertEquals(res.status, 200); const data: Student = await res.json();