This repository has been archived by the owner on Feb 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(); | ||
}); | ||
|
@@ -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], | ||
|
@@ -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, | ||
}); | ||
}); | ||
|