fix: Two API endpoints where requesting a permenantly deleted document results in server error
This commit is contained in:
@ -185,6 +185,15 @@ describe("#documents.info", () => {
|
||||
expect(body.data.id).toEqual(document.id);
|
||||
});
|
||||
|
||||
it("should not error if document doesn't exist", async () => {
|
||||
const user = await buildUser();
|
||||
|
||||
const res = await server.post("/api/documents.info", {
|
||||
body: { token: user.getJwtToken(), id: "test" },
|
||||
});
|
||||
expect(res.status).toEqual(404);
|
||||
});
|
||||
|
||||
it("should require authorization without token", async () => {
|
||||
const { document } = await seed();
|
||||
const res = await server.post("/api/documents.info", {
|
||||
@ -1309,6 +1318,15 @@ describe("#documents.restore", () => {
|
||||
expect(res.status).toEqual(403);
|
||||
});
|
||||
|
||||
it("should not error if document doesn't exist", async () => {
|
||||
const user = await buildUser();
|
||||
|
||||
const res = await server.post("/api/documents.restore", {
|
||||
body: { token: user.getJwtToken(), id: "test" },
|
||||
});
|
||||
expect(res.status).toEqual(404);
|
||||
});
|
||||
|
||||
it("should require authentication", async () => {
|
||||
const res = await server.post("/api/documents.restore");
|
||||
const body = await res.json();
|
||||
|
Reference in New Issue
Block a user