fix: Attempting to restore document in deleted collection without a collectionId override results in server error (#1777)
closes #1767
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user