style: fix deno fmt on students tests and drizzle.config
Check Deno code / Check Deno code (pull_request) Failing after 8s
Tests / Unit tests (pull_request) Successful in 11s
Tests / Integration tests (pull_request) Successful in 58s

This commit is contained in:
2026-04-26 14:18:09 +02:00
parent e5c6c389ea
commit cd5c524ff0
3 changed files with 26 additions and 6 deletions
+3 -1
View File
@@ -2,7 +2,9 @@ import { defineConfig } from "drizzle-kit";
import process from "node:process"; import process from "node:process";
const url = process.env.DATABASE_URL ?? 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({ export default defineConfig({
dialect: "postgresql", dialect: "postgresql",
+4 -1
View File
@@ -80,7 +80,10 @@ Deno.test({
assertEquals(res.status, 200); assertEquals(res.status, 200);
const body = await res.json(); const body = await res.json();
assertEquals(body.length, 2); 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, sanitizeResources: false,
sanitizeOps: false, sanitizeOps: false,
+19 -4
View File
@@ -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 () => { 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 { try {
const res = await fetch("http://localhost/api/students/99999"); const res = await fetch("http://localhost/api/students/99999");
assertEquals(res.status, 404); 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", { const res = await fetch("http://localhost/api/students", {
method: "POST", method: "POST",
headers: { "content-type": "application/json" }, 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); assertEquals(res.status, 201);
const data: Student = await res.json(); 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 () => { Deno.test("mock API: PUT /students/:numEtud updates student", async () => {
const updated = { ...students[0], nom: "Dupont-Modifié" }; 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 { try {
const res = await fetch("http://localhost/api/students/21212006", { const res = await fetch("http://localhost/api/students/21212006", {
method: "PUT", method: "PUT",
headers: { "content-type": "application/json" }, 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); assertEquals(res.status, 200);
const data: Student = await res.json(); const data: Student = await res.json();