style: fix deno fmt on students tests and drizzle.config
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user