style: fix deno fmt and lint

This commit is contained in:
2026-04-26 14:18:55 +02:00
committed by djalim
parent 08a939f7d5
commit cfb47135b5
3 changed files with 42 additions and 10 deletions
+26 -6
View File
@@ -42,7 +42,12 @@ Deno.test("mock API: GET /modules/:id returns one module", async () => {
});
Deno.test("mock API: GET /modules/:id 404 when not found", async () => {
mockFetch({ "/modules/UNKNOWN": { status: 404, body: { error: "Ressource introuvable" } } });
mockFetch({
"/modules/UNKNOWN": {
status: 404,
body: { error: "Ressource introuvable" },
},
});
try {
const res = await fetch("http://localhost/api/modules/UNKNOWN");
assertEquals(res.status, 404);
@@ -69,7 +74,13 @@ Deno.test("mock API: POST /modules creates module (201)", async () => {
});
Deno.test("mock API: POST /modules 409 on duplicate id", async () => {
mockFetch({ "/modules": { method: "POST", status: 409, body: { error: "Un module avec cet identifiant existe déjà" } } });
mockFetch({
"/modules": {
method: "POST",
status: 409,
body: { error: "Un module avec cet identifiant existe déjà" },
},
});
try {
const res = await fetch("http://localhost/api/modules", {
method: "POST",
@@ -98,7 +109,9 @@ Deno.test("mock API: POST /modules 400 on missing fields", async () => {
Deno.test("mock API: PUT /modules/:id updates nom", async () => {
const updated: Module = { id: "JIN702C", nom: "Optimisation avancée" };
mockFetch({ "/modules/JIN702C": { method: "PUT", status: 200, body: updated } });
mockFetch({
"/modules/JIN702C": { method: "PUT", status: 200, body: updated },
});
try {
const res = await fetch("http://localhost/api/modules/JIN702C", {
method: "PUT",
@@ -116,7 +129,9 @@ Deno.test("mock API: PUT /modules/:id updates nom", async () => {
Deno.test("mock API: DELETE /modules/:id returns 204", async () => {
mockFetch({ "/modules/JIN702C": { method: "DELETE", status: 204 } });
try {
const res = await fetch("http://localhost/api/modules/JIN702C", { method: "DELETE" });
const res = await fetch("http://localhost/api/modules/JIN702C", {
method: "DELETE",
});
assertEquals(res.status, 204);
} finally {
restoreFetch();
@@ -140,8 +155,13 @@ Deno.test("mock DB: insert module", () => {
Deno.test("mock DB: update module nom", () => {
const db = createMockDb({ tables: { modules: [...modules] } });
db.updateWhere<Module>("modules", (m) => m.id === "JIN702C", { nom: "Updated" });
assertEquals(db.findOne<Module>("modules", (m) => m.id === "JIN702C")?.nom, "Updated");
db.updateWhere<Module>("modules", (m) => m.id === "JIN702C", {
nom: "Updated",
});
assertEquals(
db.findOne<Module>("modules", (m) => m.id === "JIN702C")?.nom,
"Updated",
);
});
Deno.test("mock DB: delete module", () => {