fix: Attempting to restore document in deleted collection without a collectionId override results in server error (#1777)

closes #1767
This commit is contained in:
Tom Moor
2021-01-07 08:09:19 -08:00
committed by GitHub
parent de7bf8c133
commit 67a2246e1a
2 changed files with 32 additions and 8 deletions

View File

@@ -1334,7 +1334,22 @@ describe("#documents.restore", () => {
expect(body.data.collectionId).toEqual(collection.id);
});
it("should now allow restore of trashed documents to collection user cannot access", async () => {
it("should not allow restore of documents in deleted collection", async () => {
const { user, document, collection } = await seed();
await document.destroy(user.id);
await collection.destroy();
const res = await server.post("/api/documents.restore", {
body: {
token: user.getJwtToken(),
id: document.id,
},
});
expect(res.status).toEqual(400);
});
it("should not allow restore of trashed documents to collection user cannot access", async () => {
const { user, document } = await seed();
const collection = await buildCollection();