@@ -29,7 +29,7 @@
|
|||||||
"test:unit:watch": "npm run test:unit -- --watchAll --verbose false | pino-pretty",
|
"test:unit:watch": "npm run test:unit -- --watchAll --verbose false | pino-pretty",
|
||||||
"test:merge:json": "npx istanbul report --dir coverage/merged --include 'coverage/**/coverage-final.json' json-summary",
|
"test:merge:json": "npx istanbul report --dir coverage/merged --include 'coverage/**/coverage-final.json' json-summary",
|
||||||
"test:merge:text": "npx istanbul report --dir coverage/merged --include 'coverage/**/coverage-final.json' text > coverage/merged/coverage-report.txt",
|
"test:merge:text": "npx istanbul report --dir coverage/merged --include 'coverage/**/coverage-final.json' text > coverage/merged/coverage-report.txt",
|
||||||
"test:all": "jest test --forceExit --coverage --detectOpenHandles --testTimeout=600000 --verbose false --runInBand",
|
"test:all": "jest test --forceExit --coverage --detectOpenHandles --testTimeout=600000 --verbose false",
|
||||||
"kill": "kill $(lsof -t -i:3000) | exit 0"
|
"kill": "kill $(lsof -t -i:3000) | exit 0"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import UserApi from "../common/user-api";
|
|||||||
describe("The Documents Browser Window and API", () => {
|
describe("The Documents Browser Window and API", () => {
|
||||||
let platform: TestPlatform;
|
let platform: TestPlatform;
|
||||||
let currentUser: UserApi;
|
let currentUser: UserApi;
|
||||||
|
let sharedWIthMeFolder: string;
|
||||||
|
let myDriveId: string;
|
||||||
|
let files: any;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
platform = await init({
|
platform = await init({
|
||||||
@@ -25,75 +28,63 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
currentUser = await UserApi.getInstance(platform);
|
currentUser = await UserApi.getInstance(platform);
|
||||||
|
sharedWIthMeFolder = "shared_with_me";
|
||||||
|
myDriveId = "user_" + currentUser.user.id;
|
||||||
|
files = await currentUser.uploadAllFilesOneByOne(myDriveId);
|
||||||
|
|
||||||
|
expect(files).toBeDefined();
|
||||||
|
expect(files.entries()).toBeDefined();
|
||||||
|
expect(Array.from(files.entries())).toHaveLength(UserApi.ALL_FILES.length);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
await platform?.tearDown();
|
await platform?.tearDown();
|
||||||
|
// @ts-ignore
|
||||||
platform = null;
|
platform = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("My Drive", () => {
|
describe("My Drive", () => {
|
||||||
|
it("Should successfully upload filed to the 'My Drive' and browse them", async () => {
|
||||||
it("Should successfully upload filed to the 'Shared Drive' and browse them", async () => {
|
|
||||||
const myDriveId = "user_" + currentUser.user.id;
|
|
||||||
const result = await currentUser.uploadAllFilesOneByOne(myDriveId);
|
|
||||||
|
|
||||||
expect(result).toBeDefined();
|
|
||||||
expect(result.entries()).toBeDefined();
|
|
||||||
expect(Array.from(result.entries())).toHaveLength(UserApi.ALL_FILES.length);
|
|
||||||
|
|
||||||
|
|
||||||
const docs = await currentUser.browseDocuments(myDriveId, {});
|
const docs = await currentUser.browseDocuments(myDriveId, {});
|
||||||
expect(docs).toBeDefined();
|
expect(docs).toBeDefined();
|
||||||
expect(docs.children).toBeDefined();
|
expect(docs.children).toBeDefined();
|
||||||
expect(docs.children.length).toEqual(UserApi.ALL_FILES.length)
|
expect(docs.children.length).toEqual(UserApi.ALL_FILES.length);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should not be visible for other users", async () => {
|
it("Should not be visible for other users", async () => {
|
||||||
const myDriveId = "user_" + currentUser.user.id;
|
const anotherUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
||||||
const anotherUser = await UserApi.getInstance(platform, true, {companyRole: "admin"});
|
|
||||||
await currentUser.uploadAllFilesOneByOne(myDriveId);
|
|
||||||
await new Promise(r => setTimeout(r, 5000));
|
|
||||||
|
|
||||||
const docs = await currentUser.browseDocuments(myDriveId, {});
|
const docs = await currentUser.browseDocuments(myDriveId, {});
|
||||||
expect(docs).toBeDefined();
|
expect(docs).toBeDefined();
|
||||||
expect(docs.children).toBeDefined();
|
expect(docs.children).toBeDefined();
|
||||||
expect(docs.children.length).toEqual(UserApi.ALL_FILES.length)
|
expect(docs.children.length).toEqual(UserApi.ALL_FILES.length);
|
||||||
|
|
||||||
const anotherUserDocs = await anotherUser.searchDocument({});
|
const anotherUserDocs = await anotherUser.searchDocument({});
|
||||||
expect(anotherUserDocs).toBeDefined();
|
expect(anotherUserDocs).toBeDefined();
|
||||||
expect(anotherUserDocs.entities).toBeDefined();
|
expect(anotherUserDocs.entities).toBeDefined();
|
||||||
expect(anotherUserDocs.entities.length).toEqual(0);
|
expect(anotherUserDocs.entities.length).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Shared Drive", () => {
|
describe("Shared Drive", () => {
|
||||||
|
|
||||||
it("Should successfully upload filed to the 'Shared Drive' and browse them", async () => {
|
it("Should successfully upload filed to the 'Shared Drive' and browse them", async () => {
|
||||||
const result = await currentUser.uploadAllFilesOneByOne("root");
|
const result = await currentUser.uploadAllFilesOneByOne("root");
|
||||||
expect(result).toBeDefined();
|
expect(result).toBeDefined();
|
||||||
expect(result.entries()).toBeDefined();
|
expect(result.entries()).toBeDefined();
|
||||||
expect(Array.from(result.entries())).toHaveLength(UserApi.ALL_FILES.length);
|
expect(Array.from(result.entries())).toHaveLength(UserApi.ALL_FILES.length);
|
||||||
|
|
||||||
|
|
||||||
const docs = await currentUser.browseDocuments("root", {});
|
const docs = await currentUser.browseDocuments("root", {});
|
||||||
expect(docs).toBeDefined();
|
expect(docs).toBeDefined();
|
||||||
expect(docs.children).toBeDefined();
|
expect(docs.children).toBeDefined();
|
||||||
expect(docs.children.length).toEqual(UserApi.ALL_FILES.length);
|
expect(docs.children.length).toEqual(UserApi.ALL_FILES.length);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Shared With Me", () => {
|
describe("Shared With Me", () => {
|
||||||
it("Shouldn't contain user personal files", async () => {
|
it("Shouldn't contain user personal files", async () => {
|
||||||
const sharedWIthMeFolder = "shared_with_me";
|
|
||||||
await currentUser.uploadAllFilesOneByOne("user_" + currentUser.user.id);
|
|
||||||
await new Promise(r => setTimeout(r, 5000));
|
|
||||||
|
|
||||||
let docs = await currentUser.browseDocuments(sharedWIthMeFolder, {});
|
let docs = await currentUser.browseDocuments(sharedWIthMeFolder, {});
|
||||||
expect(docs).toBeDefined();
|
expect(docs).toBeDefined();
|
||||||
expect(docs.children?.length).toEqual(0)
|
expect(docs.children?.length).toEqual(0);
|
||||||
|
|
||||||
await currentUser.uploadAllFilesOneByOne("root");
|
await currentUser.uploadAllFilesOneByOne("root");
|
||||||
docs = await currentUser.browseDocuments("shared_with_me", {});
|
docs = await currentUser.browseDocuments("shared_with_me", {});
|
||||||
@@ -103,11 +94,7 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Should contain files that were shared with the user", async () => {
|
it("Should contain files that were shared with the user", async () => {
|
||||||
const sharedWIthMeFolder = "shared_with_me";
|
const anotherUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
||||||
const oneUser = await UserApi.getInstance(platform, true, {companyRole: "admin"});
|
|
||||||
const anotherUser = await UserApi.getInstance(platform, true, {companyRole: "admin"});
|
|
||||||
let files = await oneUser.uploadAllFilesOneByOne();
|
|
||||||
await new Promise(r => setTimeout(r, 5000));
|
|
||||||
|
|
||||||
//then:: files are not searchable for user without permissions
|
//then:: files are not searchable for user without permissions
|
||||||
expect((await anotherUser.browseDocuments("shared_with_me", {})).children).toHaveLength(0);
|
expect((await anotherUser.browseDocuments("shared_with_me", {})).children).toHaveLength(0);
|
||||||
@@ -119,48 +106,49 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
level: "read",
|
level: "read",
|
||||||
grantor: null,
|
grantor: null,
|
||||||
});
|
});
|
||||||
await oneUser.updateDocument(files[0].id, files[0]);
|
await currentUser.updateDocument(files[0].id, files[0]);
|
||||||
await new Promise(r => setTimeout(r, 3000));
|
await new Promise(r => setTimeout(r, 3000));
|
||||||
|
|
||||||
//then file become searchable
|
//then file become searchable
|
||||||
expect((await anotherUser.browseDocuments("shared_with_me", {pageSize: 1})).children).toHaveLength(1);
|
expect(
|
||||||
|
(await anotherUser.browseDocuments("shared_with_me", { pageSize: 1 })).children,
|
||||||
|
).toHaveLength(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should return ALL the files that was share by user at one", async () => {
|
it("Should return ALL the files that was share by user at one", async () => {
|
||||||
const oneUser = await UserApi.getInstance(platform, true, {companyRole: "admin"});
|
const anotherUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
||||||
const anotherUser = await UserApi.getInstance(platform, true, {companyRole: "admin"});
|
|
||||||
|
|
||||||
let files = await oneUser.uploadAllFilesOneByOne();
|
|
||||||
|
|
||||||
await anotherUser.uploadAllFilesOneByOne();
|
|
||||||
await new Promise(r => setTimeout(r, 5000));
|
|
||||||
|
|
||||||
//give permissions to the file
|
//give permissions to the file
|
||||||
files[2].access_info.entities.push({
|
files[2].access_info.entities.push({
|
||||||
type: "user",
|
type: "user",
|
||||||
id: anotherUser.user.id,
|
id: anotherUser.user.id,
|
||||||
level: "read",
|
level: "read",
|
||||||
|
// @ts-ignore
|
||||||
grantor: null,
|
grantor: null,
|
||||||
});
|
});
|
||||||
await oneUser.updateDocument(files[2].id, files[2]);
|
await currentUser.updateDocument(files[2].id, files[2]);
|
||||||
await new Promise(r => setTimeout(r, 3000));
|
await new Promise(r => setTimeout(r, 3000));
|
||||||
|
|
||||||
//then file become searchable
|
//then file become searchable
|
||||||
expect((await anotherUser.browseDocuments("shared_with_me", {pagination: {limitStr: 100}})).children).toHaveLength(1);
|
expect(
|
||||||
|
(await anotherUser.browseDocuments("shared_with_me", { pagination: { limitStr: 100 } }))
|
||||||
|
.children,
|
||||||
|
).toHaveLength(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("User should be able to delete file that was shared with him with 'manage' permissions", async () => {
|
it("User should be able to delete file that was shared with him with 'manage' permissions", async () => {
|
||||||
const oneUser = await UserApi.getInstance(platform, true, {companyRole: "admin"});
|
const oneUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
||||||
const anotherUser = await UserApi.getInstance(platform, true, {companyRole: "admin"});
|
const anotherUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
||||||
|
|
||||||
let files = await oneUser.uploadAllFilesOneByOne("user_" + oneUser.user.id);
|
let files = await oneUser.uploadAllFilesOneByOne("user_" + oneUser.user.id);
|
||||||
await new Promise(r => setTimeout(r, 5000));
|
await new Promise(r => setTimeout(r, 3000));
|
||||||
|
|
||||||
let toDeleteDoc = files[2];
|
let toDeleteDoc = files[2];
|
||||||
toDeleteDoc.access_info.entities.push({
|
toDeleteDoc.access_info.entities.push({
|
||||||
type: "user",
|
type: "user",
|
||||||
id: anotherUser.user.id,
|
id: anotherUser.user.id,
|
||||||
level: "manage",
|
level: "manage",
|
||||||
|
// @ts-ignore
|
||||||
grantor: null,
|
grantor: null,
|
||||||
});
|
});
|
||||||
await oneUser.updateDocument(toDeleteDoc.id, toDeleteDoc);
|
await oneUser.updateDocument(toDeleteDoc.id, toDeleteDoc);
|
||||||
@@ -172,19 +160,20 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
it("User should be able to delete folder with the files that was shared with him with 'manage' permissions", async () => {
|
it("User should be able to delete folder with the files that was shared with him with 'manage' permissions", async () => {
|
||||||
const oneUser = await UserApi.getInstance(platform, true);
|
const oneUser = await UserApi.getInstance(platform, true);
|
||||||
const anotherUser = await UserApi.getInstance(platform, true);
|
const anotherUser = await UserApi.getInstance(platform, true);
|
||||||
|
|
||||||
const dir = await oneUser.createDirectory("user_" + oneUser.user.id);
|
const dir = await oneUser.createDirectory("user_" + oneUser.user.id);
|
||||||
const level2Dir = await oneUser.createDirectory(dir.id);
|
const level2Dir = await oneUser.createDirectory(dir.id);
|
||||||
const level2Dir2 = await oneUser.createDirectory(dir.id);
|
const level2Dir2 = await oneUser.createDirectory(dir.id);
|
||||||
await oneUser.uploadAllFilesOneByOne(level2Dir.id);
|
await oneUser.uploadAllFilesOneByOne(level2Dir.id);
|
||||||
await oneUser.uploadAllFilesOneByOne(level2Dir2.id);
|
await oneUser.uploadAllFilesOneByOne(level2Dir2.id);
|
||||||
await oneUser.uploadAllFilesOneByOne(dir.id);
|
await oneUser.uploadAllFilesOneByOne(dir.id);
|
||||||
await new Promise(r => setTimeout(r, 5000));
|
await new Promise(r => setTimeout(r, 3000));
|
||||||
|
|
||||||
dir.access_info.entities.push({
|
dir.access_info.entities.push({
|
||||||
type: "user",
|
type: "user",
|
||||||
id: anotherUser.user.id,
|
id: anotherUser.user.id,
|
||||||
level: "manage",
|
level: "manage",
|
||||||
|
// @ts-ignore
|
||||||
grantor: null,
|
grantor: null,
|
||||||
});
|
});
|
||||||
await oneUser.updateDocument(dir.id, dir);
|
await oneUser.updateDocument(dir.id, dir);
|
||||||
@@ -203,6 +192,7 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
type: "user",
|
type: "user",
|
||||||
id: anotherUser.user.id,
|
id: anotherUser.user.id,
|
||||||
level: "manage",
|
level: "manage",
|
||||||
|
// @ts-ignore
|
||||||
grantor: null,
|
grantor: null,
|
||||||
});
|
});
|
||||||
await oneUser.updateDocument(dir.id, dir);
|
await oneUser.updateDocument(dir.id, dir);
|
||||||
@@ -220,7 +210,5 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
sharedDocs = await anotherUser.browseDocuments("shared_with_me");
|
sharedDocs = await anotherUser.browseDocuments("shared_with_me");
|
||||||
expect(sharedDocs.children.length).toBe(0);
|
expect(sharedDocs.children.length).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ describe("The Drive feature", () => {
|
|||||||
const files = await oneUser.uploadAllFilesOneByOne();
|
const files = await oneUser.uploadAllFilesOneByOne();
|
||||||
|
|
||||||
// Wait for file processing
|
// Wait for file processing
|
||||||
await new Promise(r => setTimeout(r, 5000));
|
await new Promise(r => setTimeout(r, 3000));
|
||||||
|
|
||||||
// Share the file with recipient user
|
// Share the file with recipient user
|
||||||
await anotherUser.shareWithPermissions(files[1], anotherUser.user.id, "read");
|
await anotherUser.shareWithPermissions(files[1], anotherUser.user.id, "read");
|
||||||
|
|||||||
@@ -3,8 +3,12 @@ import { init, TestPlatform } from "../setup";
|
|||||||
import UserApi from "../common/user-api";
|
import UserApi from "../common/user-api";
|
||||||
|
|
||||||
describe("The Documents Browser Window and API", () => {
|
describe("The Documents Browser Window and API", () => {
|
||||||
|
let sharedWIthMeFolder: string;
|
||||||
let platform: TestPlatform;
|
let platform: TestPlatform;
|
||||||
let currentUser: UserApi;
|
let currentUser: UserApi;
|
||||||
|
let anotherUser: UserApi;
|
||||||
|
let myDriveId: string;
|
||||||
|
let files: any;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
platform = await init({
|
platform = await init({
|
||||||
@@ -23,19 +27,24 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
"documents",
|
"documents",
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
currentUser = await UserApi.getInstance(platform);
|
currentUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
||||||
|
anotherUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
||||||
|
myDriveId = "user_" + currentUser.user.id;
|
||||||
|
sharedWIthMeFolder = "shared_with_me";
|
||||||
|
files = await currentUser.uploadAllFilesOneByOne(myDriveId);
|
||||||
|
for (const file of files) {
|
||||||
|
await currentUser.shareWithPermissions(file, anotherUser.user.id, "read");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
await platform?.tearDown();
|
await platform?.tearDown();
|
||||||
|
// @ts-ignore
|
||||||
platform = null;
|
platform = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Pagination and Sorting", () => {
|
describe("Pagination and Sorting", () => {
|
||||||
it("Should paginate documents correctly", async () => {
|
it("Should paginate documents correctly", async () => {
|
||||||
const myDriveId = "user_" + currentUser.user.id;
|
|
||||||
await currentUser.uploadAllFilesOneByOne(myDriveId);
|
|
||||||
|
|
||||||
let page_token = "1";
|
let page_token = "1";
|
||||||
const limitStr = "2";
|
const limitStr = "2";
|
||||||
let docs = await currentUser.browseDocuments(myDriveId, {
|
let docs = await currentUser.browseDocuments(myDriveId, {
|
||||||
@@ -60,9 +69,6 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Should sort documents by name in ascending order", async () => {
|
it("Should sort documents by name in ascending order", async () => {
|
||||||
const myDriveId = "user_" + currentUser.user.id;
|
|
||||||
await currentUser.uploadAllFilesOneByOne(myDriveId);
|
|
||||||
|
|
||||||
const sortBy = "name";
|
const sortBy = "name";
|
||||||
const sortOrder = "asc";
|
const sortOrder = "asc";
|
||||||
const docs = await currentUser.browseDocuments(myDriveId, {
|
const docs = await currentUser.browseDocuments(myDriveId, {
|
||||||
@@ -75,9 +81,6 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Should sort documents by name in descending order", async () => {
|
it("Should sort documents by name in descending order", async () => {
|
||||||
const myDriveId = "user_" + currentUser.user.id;
|
|
||||||
await currentUser.uploadAllFilesOneByOne(myDriveId);
|
|
||||||
|
|
||||||
const sortBy = "name";
|
const sortBy = "name";
|
||||||
const sortOrder = "desc";
|
const sortOrder = "desc";
|
||||||
const docs = await currentUser.browseDocuments(myDriveId, {
|
const docs = await currentUser.browseDocuments(myDriveId, {
|
||||||
@@ -90,9 +93,6 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Should sort documents by date in ascending order", async () => {
|
it("Should sort documents by date in ascending order", async () => {
|
||||||
const myDriveId = "user_" + currentUser.user.id;
|
|
||||||
await currentUser.uploadAllFilesOneByOne(myDriveId);
|
|
||||||
|
|
||||||
const sortBy = "date";
|
const sortBy = "date";
|
||||||
const sortOrder = "asc";
|
const sortOrder = "asc";
|
||||||
const docs = await currentUser.browseDocuments(myDriveId, {
|
const docs = await currentUser.browseDocuments(myDriveId, {
|
||||||
@@ -107,9 +107,6 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Should sort documents by date in descending order", async () => {
|
it("Should sort documents by date in descending order", async () => {
|
||||||
const myDriveId = "user_" + currentUser.user.id;
|
|
||||||
await currentUser.uploadAllFilesOneByOne(myDriveId);
|
|
||||||
|
|
||||||
const sortBy = "date";
|
const sortBy = "date";
|
||||||
const sortOrder = "desc";
|
const sortOrder = "desc";
|
||||||
const docs = await currentUser.browseDocuments(myDriveId, {
|
const docs = await currentUser.browseDocuments(myDriveId, {
|
||||||
@@ -124,9 +121,6 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Should sort documents by size in ascending order", async () => {
|
it("Should sort documents by size in ascending order", async () => {
|
||||||
const myDriveId = "user_" + currentUser.user.id;
|
|
||||||
await currentUser.uploadAllFilesOneByOne(myDriveId);
|
|
||||||
|
|
||||||
const sortBy = "size";
|
const sortBy = "size";
|
||||||
const sortOrder = "asc";
|
const sortOrder = "asc";
|
||||||
const docs = await currentUser.browseDocuments(myDriveId, {
|
const docs = await currentUser.browseDocuments(myDriveId, {
|
||||||
@@ -139,9 +133,6 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Should sort documents by size in descending order", async () => {
|
it("Should sort documents by size in descending order", async () => {
|
||||||
const myDriveId = "user_" + currentUser.user.id;
|
|
||||||
await currentUser.uploadAllFilesOneByOne(myDriveId);
|
|
||||||
|
|
||||||
const sortBy = "size";
|
const sortBy = "size";
|
||||||
const sortOrder = "desc";
|
const sortOrder = "desc";
|
||||||
const docs = await currentUser.browseDocuments(myDriveId, {
|
const docs = await currentUser.browseDocuments(myDriveId, {
|
||||||
@@ -154,17 +145,6 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Should paginate shared with me ", async () => {
|
it("Should paginate shared with me ", async () => {
|
||||||
const sharedWIthMeFolder = "shared_with_me";
|
|
||||||
const oneUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
|
||||||
const anotherUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
|
||||||
let files = await oneUser.uploadAllFilesOneByOne();
|
|
||||||
for (const file of files) {
|
|
||||||
await oneUser.shareWithPermissions(file, anotherUser.user.id, "read");
|
|
||||||
}
|
|
||||||
|
|
||||||
// wait for files to be indexed
|
|
||||||
await new Promise(r => setTimeout(r, 5000));
|
|
||||||
|
|
||||||
let page_token: any = "1";
|
let page_token: any = "1";
|
||||||
const limitStr = "2";
|
const limitStr = "2";
|
||||||
let docs = await anotherUser.browseDocuments(sharedWIthMeFolder, {
|
let docs = await anotherUser.browseDocuments(sharedWIthMeFolder, {
|
||||||
@@ -189,13 +169,6 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Should sort shared with me by name in ascending order", async () => {
|
it("Should sort shared with me by name in ascending order", async () => {
|
||||||
const sharedWIthMeFolder = "shared_with_me";
|
|
||||||
const oneUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
|
||||||
const anotherUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
|
||||||
let files = await oneUser.uploadAllFilesOneByOne();
|
|
||||||
for (const file of files) {
|
|
||||||
await oneUser.shareWithPermissions(file, anotherUser.user.id, "read");
|
|
||||||
}
|
|
||||||
const sortBy = "name";
|
const sortBy = "name";
|
||||||
const sortOrder = "asc";
|
const sortOrder = "asc";
|
||||||
const docs = await anotherUser.browseDocuments(sharedWIthMeFolder, {
|
const docs = await anotherUser.browseDocuments(sharedWIthMeFolder, {
|
||||||
@@ -208,13 +181,6 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Should sort shared with me by name in descending order", async () => {
|
it("Should sort shared with me by name in descending order", async () => {
|
||||||
const sharedWIthMeFolder = "shared_with_me";
|
|
||||||
const oneUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
|
||||||
const anotherUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
|
||||||
let files = await oneUser.uploadAllFilesOneByOne();
|
|
||||||
for (const file of files) {
|
|
||||||
await oneUser.shareWithPermissions(file, anotherUser.user.id, "read");
|
|
||||||
}
|
|
||||||
const sortBy = "name";
|
const sortBy = "name";
|
||||||
const sortOrder = "desc";
|
const sortOrder = "desc";
|
||||||
const docs = await anotherUser.browseDocuments(sharedWIthMeFolder, {
|
const docs = await anotherUser.browseDocuments(sharedWIthMeFolder, {
|
||||||
@@ -227,13 +193,6 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Should sort shared with me by size in ascending order", async () => {
|
it("Should sort shared with me by size in ascending order", async () => {
|
||||||
const sharedWIthMeFolder = "shared_with_me";
|
|
||||||
const oneUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
|
||||||
const anotherUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
|
||||||
let files = await oneUser.uploadAllFilesOneByOne();
|
|
||||||
for (const file of files) {
|
|
||||||
await oneUser.shareWithPermissions(file, anotherUser.user.id, "read");
|
|
||||||
}
|
|
||||||
const sortBy = "size";
|
const sortBy = "size";
|
||||||
const sortOrder = "asc";
|
const sortOrder = "asc";
|
||||||
const docs = await anotherUser.browseDocuments(sharedWIthMeFolder, {
|
const docs = await anotherUser.browseDocuments(sharedWIthMeFolder, {
|
||||||
@@ -246,13 +205,6 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Should sort shared with me by size in descending order", async () => {
|
it("Should sort shared with me by size in descending order", async () => {
|
||||||
const sharedWIthMeFolder = "shared_with_me";
|
|
||||||
const oneUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
|
||||||
const anotherUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
|
||||||
let files = await oneUser.uploadAllFilesOneByOne();
|
|
||||||
for (const file of files) {
|
|
||||||
await oneUser.shareWithPermissions(file, anotherUser.user.id, "read");
|
|
||||||
}
|
|
||||||
const sortBy = "size";
|
const sortBy = "size";
|
||||||
const sortOrder = "desc";
|
const sortOrder = "desc";
|
||||||
const docs = await anotherUser.browseDocuments(sharedWIthMeFolder, {
|
const docs = await anotherUser.browseDocuments(sharedWIthMeFolder, {
|
||||||
@@ -265,13 +217,6 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Should sort shared with me by date in ascending order", async () => {
|
it("Should sort shared with me by date in ascending order", async () => {
|
||||||
const sharedWIthMeFolder = "shared_with_me";
|
|
||||||
const oneUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
|
||||||
const anotherUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
|
||||||
let files = await oneUser.uploadAllFilesOneByOne();
|
|
||||||
for (const file of files) {
|
|
||||||
await oneUser.shareWithPermissions(file, anotherUser.user.id, "read");
|
|
||||||
}
|
|
||||||
const sortBy = "date";
|
const sortBy = "date";
|
||||||
const sortOrder = "asc";
|
const sortOrder = "asc";
|
||||||
const docs = await anotherUser.browseDocuments(sharedWIthMeFolder, {
|
const docs = await anotherUser.browseDocuments(sharedWIthMeFolder, {
|
||||||
@@ -286,13 +231,6 @@ describe("The Documents Browser Window and API", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Should sort shared with me by date in descending order", async () => {
|
it("Should sort shared with me by date in descending order", async () => {
|
||||||
const sharedWIthMeFolder = "shared_with_me";
|
|
||||||
const oneUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
|
||||||
const anotherUser = await UserApi.getInstance(platform, true, { companyRole: "admin" });
|
|
||||||
let files = await oneUser.uploadAllFilesOneByOne();
|
|
||||||
for (const file of files) {
|
|
||||||
await oneUser.shareWithPermissions(file, anotherUser.user.id, "read");
|
|
||||||
}
|
|
||||||
const sortBy = "date";
|
const sortBy = "date";
|
||||||
const sortOrder = "desc";
|
const sortOrder = "desc";
|
||||||
const docs = await anotherUser.browseDocuments(sharedWIthMeFolder, {
|
const docs = await anotherUser.browseDocuments(sharedWIthMeFolder, {
|
||||||
|
|||||||
Reference in New Issue
Block a user