Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Commit

Permalink
fix: change test
Browse files Browse the repository at this point in the history
  • Loading branch information
ludverst committed May 3, 2023
1 parent 28ae0ee commit a68aa86
Showing 1 changed file with 72 additions and 4 deletions.
76 changes: 72 additions & 4 deletions api/__tests__/routes/region.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,75 @@ describe("Region tests", () => {
});
});

//TODO: fix, voor admin
// test("SOFT DELETE /region/:id", async () => {
// const regionSoft = {
// hardDelete: false,
// };
// await runner.delete({ url: "/region/3", data: regionSoft });

// // verify that the region is truly deleted
// const expected = [
// {
// deleted: false,
// id: 1,
// name: "Region 1",
// users: [
// {
// id: 1,
// region_id: 1,
// user: {
// address_id: 1,
// admin: false,
// date_added: "2023-05-04T12:00:00.000Z",
// deleted: false,
// email: "[email protected]",
// first_name: "Dirk",
// id: 1,
// last_login: "2023-05-04T12:00:00.000Z",
// last_name: "De Student",
// phone: "0123456789",
// student: true,
// super_student: false,
// },
// user_id: 1,
// },
// ],
// },
// {
// deleted: false,
// id: 2,
// name: "Region 2",
// users: [
// {
// id: 2,
// region_id: 2,
// user: {
// address_id: 2,
// admin: false,
// date_added: "2023-05-04T12:00:00.000Z",
// deleted: false,
// email: "[email protected]",
// first_name: "Toon",
// id: 2,
// last_login: "2023-05-04T12:00:00.000Z",
// last_name: "De Superstudent",
// phone: "9876543210",
// student: false,
// super_student: true,
// },
// user_id: 2,
// },
// ],
// },
// { deleted: true, id: 3, name: "Region 3", users: [] },
// ];
// await runner.get({
// url: "/region?deleted=true",
// expectedData: expected,
// });
// });

afterAll(() => {
app.close();
});
Expand Down Expand Up @@ -293,9 +362,7 @@ describe("Region tests", () => {
expectedData: [notFoundResponse],
statusCode: 404,
});
});

test("Find a nonexistent region", async () => {
await runner.get({
url: "/region/-1",
expectedData: [notFoundResponse],
Expand All @@ -304,9 +371,10 @@ describe("Region tests", () => {
});

test("Update a nonexistent region", async () => {
await runner.get({
await runner.patch({
url: "/region/0",
expectedData: [notFoundResponse],
data: newRegion,
expectedResponse: notFoundResponse,
statusCode: 404,
});
});
Expand Down

0 comments on commit a68aa86

Please sign in to comment.