Skip to content

Commit

Permalink
🎨 cleaning up formatting (#433)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericlinagora committed May 28, 2024
1 parent 06d6db2 commit 2086ae5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tdrive/backend/node/test/e2e/documents/trash.spec.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 2086ae5

Please sign in to comment.