Skip to content

Commit

Permalink
feat: updated document quota e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
Monta authored and Monta committed Mar 22, 2024
1 parent fbf7d69 commit 2433a85
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tdrive/backend/node/test/e2e/documents/documents-quota.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ResourceUpdateResponse } from "../../../src/utils/types";
jest.mock("config");

describe("the Drive feature", () => {
const filesUrl = "/internal/services/files/v1";
let platform: TestPlatform;
let currentUser: UserApi;
let configHasSpy: jest.SpyInstance;
Expand Down Expand Up @@ -71,13 +72,20 @@ describe("the Drive feature", () => {
});

it("did not upload the drive item with size above quota", async () => {
const result: any = await currentUser.uploadFileAndCreateDocument("sample.mp4");
const item = await currentUser.uploadFile("sample.mp4");
expect(item).toBeDefined();
const result: any = await currentUser.createDocumentFromFile(item);
expect(result).toBeDefined();
expect(result.statusCode).toBe(403);
expect(result.error).toBe("Forbidden");
expect(result.message).toContain("Not enough space");

//TODO[ASH] check that the file was deleted
const fileDownloadResponse = await platform.app.inject({
method: "GET",
url: `${filesUrl}/companies/${platform.workspace.company_id}/files/${item.id}/download`,
});
// make sure the file was removed
expect(fileDownloadResponse).toBeTruthy();
expect(fileDownloadResponse.statusCode).toBe(404);
});

it("did create a version for a drive item", async () => {
Expand All @@ -98,5 +106,12 @@ describe("the Drive feature", () => {
});
expect(result).toBeDefined();
expect(result.statusCode).toBe(403);
const fileDownloadResponse = await platform.app.inject({
method: "GET",
url: `${filesUrl}/companies/${platform.workspace.company_id}/files/${item.id}/download`,
});
// make sure the file was removed
expect(fileDownloadResponse).toBeTruthy();
expect(fileDownloadResponse.statusCode).toBe(404);
});
});

0 comments on commit 2433a85

Please sign in to comment.