chore: formated tests
Check Deno code / Check Deno code (pull_request) Successful in 5s
Tests / Unit tests (pull_request) Successful in 12s
Tests / Integration tests (pull_request) Successful in 1m9s
Check Deno code / Check Deno code (push) Successful in 6s
Tests / Unit tests (push) Successful in 12s
Tests / Integration tests (push) Successful in 1m13s
Check Deno code / Check Deno code (pull_request) Successful in 5s
Tests / Unit tests (pull_request) Successful in 12s
Tests / Integration tests (pull_request) Successful in 1m9s
Check Deno code / Check Deno code (push) Successful in 6s
Tests / Unit tests (push) Successful in 12s
Tests / Integration tests (push) Successful in 1m13s
This commit was merged in pull request #145.
This commit is contained in:
+28
-6
@@ -24,7 +24,10 @@ Deno.test({
|
||||
{ id: "dupont.jean", nom: "Dupont", prenom: "Jean" },
|
||||
{ id: "martin.alice", nom: "Martin", prenom: "Alice" },
|
||||
]);
|
||||
const res = await usersHandler.GET!(makeGetRequest("/users"), makeEmployeeContext());
|
||||
const res = await usersHandler.GET!(
|
||||
makeGetRequest("/users"),
|
||||
makeEmployeeContext(),
|
||||
);
|
||||
assertEquals(res.status, 200);
|
||||
const body = await res.json();
|
||||
assertEquals(body.length, 2);
|
||||
@@ -38,7 +41,10 @@ Deno.test({
|
||||
name: "e2e users: GET /users returns empty when no users",
|
||||
async fn() {
|
||||
await truncateAll();
|
||||
const res = await usersHandler.GET!(makeGetRequest("/users"), makeEmployeeContext());
|
||||
const res = await usersHandler.GET!(
|
||||
makeGetRequest("/users"),
|
||||
makeEmployeeContext(),
|
||||
);
|
||||
assertEquals(res.status, 200);
|
||||
const body = await res.json();
|
||||
assertEquals(body.length, 0);
|
||||
@@ -77,7 +83,11 @@ Deno.test({
|
||||
async fn() {
|
||||
await truncateAll();
|
||||
const res = await usersHandler.POST!(
|
||||
makeJsonRequest("/users", "POST", { id: "new.user", nom: "New", prenom: "User" }),
|
||||
makeJsonRequest("/users", "POST", {
|
||||
id: "new.user",
|
||||
nom: "New",
|
||||
prenom: "User",
|
||||
}),
|
||||
makeEmployeeContext(),
|
||||
);
|
||||
assertEquals(res.status, 201);
|
||||
@@ -109,7 +119,11 @@ Deno.test({
|
||||
await truncateAll();
|
||||
await seedUsers([{ id: "dupont.jean", nom: "Dupont", prenom: "Jean" }]);
|
||||
const res = await usersHandler.POST!(
|
||||
makeJsonRequest("/users", "POST", { id: "dupont.jean", nom: "Doublon", prenom: "X" }),
|
||||
makeJsonRequest("/users", "POST", {
|
||||
id: "dupont.jean",
|
||||
nom: "Doublon",
|
||||
prenom: "X",
|
||||
}),
|
||||
makeEmployeeContext(),
|
||||
);
|
||||
assertEquals(res.status, 409);
|
||||
@@ -160,7 +174,11 @@ Deno.test({
|
||||
await truncateAll();
|
||||
await seedUsers([{ id: "thomas.eva", nom: "Thomas", prenom: "Eva" }]);
|
||||
const res = await userHandler.PUT!(
|
||||
makeJsonRequest("/users/thomas.eva", "PUT", { nom: "Thomas-Modifié", prenom: "Eva", idRole: null }),
|
||||
makeJsonRequest("/users/thomas.eva", "PUT", {
|
||||
nom: "Thomas-Modifié",
|
||||
prenom: "Eva",
|
||||
idRole: null,
|
||||
}),
|
||||
makeEmployeeContext({ id: "thomas.eva" }),
|
||||
);
|
||||
assertEquals(res.status, 200);
|
||||
@@ -176,7 +194,11 @@ Deno.test({
|
||||
async fn() {
|
||||
await truncateAll();
|
||||
const res = await userHandler.PUT!(
|
||||
makeJsonRequest("/users/ghost.user", "PUT", { nom: "X", prenom: "Y", idRole: null }),
|
||||
makeJsonRequest("/users/ghost.user", "PUT", {
|
||||
nom: "X",
|
||||
prenom: "Y",
|
||||
idRole: null,
|
||||
}),
|
||||
makeEmployeeContext({ id: "ghost.user" }),
|
||||
);
|
||||
assertEquals(res.status, 404);
|
||||
|
||||
Reference in New Issue
Block a user