🍄 Separate trash for the personal and shared drive (#189)

This commit is contained in:
Montassar Ghanmy
2023-10-06 17:05:07 +01:00
committed by GitHub
parent f0dcf34bbe
commit edfd765d57
34 changed files with 440 additions and 185 deletions
@@ -29,6 +29,7 @@ export class DriveFileMockClass {
access_info: MockAccessInformation;
creator: string;
is_directory: boolean;
scope: "personal" | "shared";
created_by: Record<string, any>;
shared_by: Record<string, any>;
}
@@ -59,11 +59,12 @@ describe("the Drive feature", () => {
const createItem = async (): Promise<DriveFileMockClass> => {
await TestDbService.getInstance(platform, true);
const scope: "personal" | "shared" = "shared";
const item = {
name: "new test file",
parent_id: "root",
company_id: platform.workspace.company_id,
scope,
};
const version = {};
@@ -141,8 +142,9 @@ describe("the Drive feature", () => {
DriveItemDetailsMockClass,
listTrashResponse.body,
);
expect(listTrashResult.item.name).toEqual("Trash");
expect(createItemResult).toBeDefined();
expect(createItemResult.scope).toEqual("shared");
expect(listTrashResult.children.some(({ id }) => id === createItemResult.id)).toBeTruthy();
});
@@ -62,11 +62,9 @@ describe("the public links feature", () => {
platform = null;
});
describe("Basic Flow", () => {
const createItem = async (): Promise<DriveFileMockClass> => {
await TestHelpers.getInstance(platform, true, {companyRole: "admin"});
await TestHelpers.getInstance(platform, true, { companyRole: "admin" });
const item = {
name: "public file",
@@ -284,33 +282,7 @@ describe("the public links feature", () => {
});
});
describe("Share file from My Drive", () => {
it("Share file from some folder", async () => {
const user = await TestHelpers.getInstance(platform, true);
const anotherUser = await TestHelpers.getInstance(platform, true);
//create directory in "My Drive" and upload a file
const directory = await user.createDirectory("user_" + user.user.id);
const doc = await user.createRandomDocument(directory.id);
//check that another user doesn't see any file
expect((await anotherUser.getDocument(doc.id)).statusCode).toBe(401);
//share file with the public link
await user.shareWithPublicLink(doc, "read");
const token = await anotherUser.getPublicLinkAccessToken(doc);
anotherUser.jwt = token.value;
await anotherUser.getDocumentOKCheck(doc.id);
});
});
describe("Download Folder from shared link", () => {
it("Share folder", async () => {
const user = await TestHelpers.getInstance(platform, true);
const anotherUser = await TestHelpers.getInstance(platform, true);
@@ -332,9 +304,5 @@ describe("the public links feature", () => {
expect((await anotherUser.getFolder(doc.id)).statusCode).toBe(200);
});
});
});
});