From 6fc5d0945d30a967a096e86a19a4e609906446c2 Mon Sep 17 00:00:00 2001 From: Eric Doughty-Papassideris Date: Wed, 29 May 2024 00:34:28 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20cleaning=20up=20formatting=20(#4?= =?UTF-8?q?33)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/node/test/e2e/documents/trash.spec.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tdrive/backend/node/test/e2e/documents/trash.spec.ts b/tdrive/backend/node/test/e2e/documents/trash.spec.ts index 19e0e704..93f2d5f2 100644 --- a/tdrive/backend/node/test/e2e/documents/trash.spec.ts +++ b/tdrive/backend/node/test/e2e/documents/trash.spec.ts @@ -1,6 +1,6 @@ import { describe, beforeAll, it, expect, afterAll } from "@jest/globals"; import { deserialize } from "class-transformer"; -import type { DriveFile } from "../../../src/services/documents/entities/drive-file"; + import { init, TestPlatform } from "../setup"; import { TestDbService } from "../utils.prepare.db"; import UserApi from "../common/user-api"; @@ -57,7 +57,6 @@ describe("the Drive's documents' trash feature", () => { expect(result.item.name).toEqual("Trash"); }); - async function getTrashContentIds(scope: "shared" | "personal") { const id = scope === "shared" ? "trash" : currentUserTrash!; const listTrashResponse = await currentUser.getDocument(id); @@ -99,14 +98,16 @@ describe("the Drive's documents' trash feature", () => { expect(createItemResult.scope).toEqual("personal"); expect(await getTrashContentIds("personal")).not.toContain(createItemResult.id); + const moveToTrashResponse = await currentUser.delete(createItemResult.id); expect(moveToTrashResponse.statusCode).toEqual(200); + expect(await getTrashContentIds("personal")).toContain(createItemResult.id); expect(await getTrashContentIds("shared")).not.toContain(createItemResult.id); }); - describe("deleting a file uploaded by an anonymous user should go to the sharers trash", () => { - it("finds the owner from the immediate parent folder", async () => { + describe("deleting a file uploaded by an anonymous user should go to the personal trash of the creator of the shared folder", () => { + it("finds the owner from the immediate shared parent folder", async () => { const publiclyWriteableFolder = await currentUser.createDirectory(currentUserRoot, { scope: "personal" }); const setPublicWriteableResponse = await currentUser.shareWithPublicLink(publiclyWriteableFolder, "write"); expect(setPublicWriteableResponse.statusCode).toBe(200); @@ -125,7 +126,7 @@ describe("the Drive's documents' trash feature", () => { expect((await getTrashContentIds("personal"))).toContain(anonymouslyUploadedDoc.id); }); - it("finds the owner from the indirect parent folder", async () => { + it("finds the owner from the indirect shared parent folder", async () => { const publiclyWriteableFolder = await currentUser.createDirectory(currentUserRoot, { scope: "personal" }); const setPublicWriteableResponse = await currentUser.shareWithPublicLink(publiclyWriteableFolder, "write"); expect(setPublicWriteableResponse.statusCode).toBe(200); @@ -147,7 +148,7 @@ describe("the Drive's documents' trash feature", () => { expect((await getTrashContentIds("personal"))).toContain(anonymouslyUploadedDoc.id); }); - it("goes into the sharers trash even if another user deletes the file", async () => { + it("goes into the creator of the shared folder s trash even if another user deletes the file", async () => { const publiclyWriteableFolder = await currentUser.createDirectory(currentUserRoot, { scope: "personal" }); const setPublicWriteableResponse = await currentUser.shareWithPublicLink(publiclyWriteableFolder, "write"); expect(setPublicWriteableResponse.statusCode).toBe(200);