From 49ec7b5dfa18ca7c56366b4786fc68a5db944828 Mon Sep 17 00:00:00 2001 From: Anton SHEPILOV Date: Tue, 3 Dec 2024 17:09:26 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8FMoved=20default=20services=20?= =?UTF-8?q?list=20to=20util=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tdrive/backend/node/test/e2e/av/av.spec.ts | 19 +--------- .../e2e/console/backchannel-logout.spec.ts | 21 +---------- .../e2e/documents/documents-browser.spec.ts | 22 ++--------- .../documents/documents-manage-access.spec.ts | 23 +----------- .../documents/documents-notifications.spec.ts | 24 +----------- .../documents-pagination-sorting.spec.ts | 19 +--------- .../e2e/documents/documents-quota.spec.ts | 23 +----------- .../e2e/documents/documents-search.spec.ts | 22 +---------- .../test/e2e/documents/documents-tab.spec.ts | 23 +----------- .../node/test/e2e/documents/documents.spec.ts | 23 +----------- .../e2e/documents/editing-session.spec.ts | 25 +------------ .../node/test/e2e/documents/my-drive.spec.ts | 34 +---------------- .../test/e2e/documents/public-links.spec.ts | 12 +++--- .../node/test/e2e/documents/trash.spec.ts | 25 +------------ .../backend/node/test/e2e/files/files.spec.ts | 6 +-- .../node/test/e2e/files/storage.oneof.spec.ts | 6 +-- tdrive/backend/node/test/e2e/setup/index.ts | 37 ++++++++++++++++++- .../backend/node/test/e2e/tags/tags.spec.ts | 6 +-- .../node/test/e2e/users/users.quota.spec.ts | 30 +++------------ .../node/test/e2e/users/users.search.spec.ts | 20 +--------- .../backend/node/test/e2e/users/users.spec.ts | 20 +--------- .../e2e/workspaces/workspace-users.spec.ts | 20 +--------- .../test/e2e/workspaces/workspaces.spec.ts | 20 +--------- 23 files changed, 89 insertions(+), 391 deletions(-) diff --git a/tdrive/backend/node/test/e2e/av/av.spec.ts b/tdrive/backend/node/test/e2e/av/av.spec.ts index 86cdd0260..88246dfe2 100644 --- a/tdrive/backend/node/test/e2e/av/av.spec.ts +++ b/tdrive/backend/node/test/e2e/av/av.spec.ts @@ -1,7 +1,7 @@ import "./load_test_config"; import "reflect-metadata"; import { afterAll, beforeEach, describe, expect, it, jest } from "@jest/globals"; -import { init, TestPlatform } from "../setup"; +import { init, initWithDefaults, TestPlatform } from "../setup"; import { deserialize } from "class-transformer"; import UserApi from "../common/user-api"; import { DriveItemDetailsMockClass } from "../common/entities/mock_entities"; @@ -19,22 +19,7 @@ describe("The documents antivirus", () => { ); beforeEach(async () => { - platform = await init({ - services: [ - "webserver", - "database", - "applications", - "search", - "storage", - "message-queue", - "user", - "files", - "auth", - "statistics", - "platform-services", - "documents", - ], - }); + platform = await initWithDefaults(); }); afterAll(async () => { diff --git a/tdrive/backend/node/test/e2e/console/backchannel-logout.spec.ts b/tdrive/backend/node/test/e2e/console/backchannel-logout.spec.ts index 3d7d53d09..7ffb788d0 100644 --- a/tdrive/backend/node/test/e2e/console/backchannel-logout.spec.ts +++ b/tdrive/backend/node/test/e2e/console/backchannel-logout.spec.ts @@ -1,5 +1,5 @@ import { afterAll, beforeAll, beforeEach, describe, expect, it } from "@jest/globals"; -import { init, TestPlatform } from "../setup"; +import { init, initWithDefaults, TestPlatform } from "../setup"; import { TestDbService } from "../utils.prepare.db"; import UserApi from "../common/user-api"; @@ -15,24 +15,7 @@ describe("The /backchannel_logout API", () => { }); beforeAll(async () => { - platform = await init({ - services: [ - "database", - "search", - "message-queue", - "websocket", - "applications", - "webserver", - "user", - "auth", - "storage", - "counter", - "console", - "workspaces", - "statistics", - "platform-services", - ], - }); + platform = await initWithDefaults(); testDbService = await TestDbService.getInstance(platform); }); diff --git a/tdrive/backend/node/test/e2e/documents/documents-browser.spec.ts b/tdrive/backend/node/test/e2e/documents/documents-browser.spec.ts index 025175ca9..3811463d6 100644 --- a/tdrive/backend/node/test/e2e/documents/documents-browser.spec.ts +++ b/tdrive/backend/node/test/e2e/documents/documents-browser.spec.ts @@ -1,6 +1,5 @@ import { describe, beforeEach, afterEach, it, expect, afterAll } from "@jest/globals"; -import { init, TestPlatform } from "../setup"; -import { TestDbService } from "../utils.prepare.db"; +import {initWithDefaults, TestPlatform } from "../setup"; import UserApi from "../common/user-api"; describe("The Documents Browser Window and API", () => { @@ -11,22 +10,7 @@ describe("The Documents Browser Window and API", () => { let files: any; beforeEach(async () => { - platform = await init({ - services: [ - "webserver", - "database", - "applications", - "search", - "storage", - "message-queue", - "user", - "files", - "auth", - "statistics", - "platform-services", - "documents", - ], - }); + platform = await initWithDefaults(); currentUser = await UserApi.getInstance(platform); sharedWIthMeFolder = "shared_with_me"; myDriveId = "user_" + currentUser.user.id; @@ -37,7 +21,7 @@ describe("The Documents Browser Window and API", () => { expect(Array.from(files.entries())).toHaveLength(UserApi.ALL_FILES.length); }); - afterAll(async () => { + afterEach(async () => { await platform?.tearDown(); // @ts-ignore platform = null; diff --git a/tdrive/backend/node/test/e2e/documents/documents-manage-access.spec.ts b/tdrive/backend/node/test/e2e/documents/documents-manage-access.spec.ts index 91403c575..6900859da 100644 --- a/tdrive/backend/node/test/e2e/documents/documents-manage-access.spec.ts +++ b/tdrive/backend/node/test/e2e/documents/documents-manage-access.spec.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, describe, expect, it } from "@jest/globals"; -import { init, TestPlatform } from "../setup"; +import { initWithDefaults, TestPlatform } from "../setup"; import UserApi from "../common/user-api"; import config from "config"; @@ -28,26 +28,7 @@ describe("The Drive feature", () => { }); // Initialize platform with required services - platform = await init({ - services: [ - "webserver", - "database", - "applications", - "search", - "storage", - "message-queue", - "user", - "search", - "files", - "messages", - "auth", - "channels", - "counter", - "statistics", - "platform-services", - "documents", - ], - }); + platform = await initWithDefaults(); }); afterEach(async () => { diff --git a/tdrive/backend/node/test/e2e/documents/documents-notifications.spec.ts b/tdrive/backend/node/test/e2e/documents/documents-notifications.spec.ts index e8b588869..ba5bd6fa1 100644 --- a/tdrive/backend/node/test/e2e/documents/documents-notifications.spec.ts +++ b/tdrive/backend/node/test/e2e/documents/documents-notifications.spec.ts @@ -1,5 +1,5 @@ import { describe, beforeEach, it, expect, afterAll, jest } from "@jest/globals"; -import { init, TestPlatform } from "../setup"; +import { initWithDefaults, TestPlatform } from "../setup"; import UserApi from "../common/user-api"; import * as utils from "../../../src/services/documents/utils"; import { DocumentsEngine } from "../../../src/services/documents/services/engine"; @@ -22,27 +22,7 @@ describe("the Drive feature", () => { let currentUser: UserApi; beforeEach(async () => { - platform = await init({ - services: [ - "webserver", - "database", - "applications", - "search", - "storage", - "message-queue", - "user", - "search", - "files", - "messages", - "auth", - "channels", - "counter", - "statistics", - "platform-services", - "documents", - "email-pusher", - ], - }); + platform = await initWithDefaults(); currentUser = await UserApi.getInstance(platform); }); diff --git a/tdrive/backend/node/test/e2e/documents/documents-pagination-sorting.spec.ts b/tdrive/backend/node/test/e2e/documents/documents-pagination-sorting.spec.ts index 842fc601d..2e80012d8 100644 --- a/tdrive/backend/node/test/e2e/documents/documents-pagination-sorting.spec.ts +++ b/tdrive/backend/node/test/e2e/documents/documents-pagination-sorting.spec.ts @@ -1,5 +1,5 @@ import { describe, beforeAll, afterAll, it, expect } from "@jest/globals"; -import { init, TestPlatform } from "../setup"; +import { init, initWithDefaults, TestPlatform } from "../setup"; import UserApi from "../common/user-api"; describe("The Documents Browser Window and API", () => { @@ -11,22 +11,7 @@ describe("The Documents Browser Window and API", () => { let files: any; beforeAll(async () => { - platform = await init({ - services: [ - "webserver", - "database", - "applications", - "search", - "storage", - "message-queue", - "user", - "files", - "auth", - "statistics", - "platform-services", - "documents", - ], - }); + platform = await initWithDefaults(); currentUser = await UserApi.getInstance(platform, true, { companyRole: "admin" }); anotherUser = await UserApi.getInstance(platform, true, { companyRole: "admin" }); myDriveId = "user_" + currentUser.user.id; diff --git a/tdrive/backend/node/test/e2e/documents/documents-quota.spec.ts b/tdrive/backend/node/test/e2e/documents/documents-quota.spec.ts index c7da9f38c..f943f5400 100644 --- a/tdrive/backend/node/test/e2e/documents/documents-quota.spec.ts +++ b/tdrive/backend/node/test/e2e/documents/documents-quota.spec.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, describe, expect, it } from "@jest/globals"; -import { init, TestPlatform } from "../setup"; +import { initWithDefaults, TestPlatform } from "../setup"; import UserApi from "../common/user-api"; import config from "config"; import { e2e_createDocumentFile, e2e_createVersion } from "./utils"; @@ -33,26 +33,7 @@ describe("the Drive feature", () => { } return jest.requireActual("config").get(setting); }); - platform = await init({ - services: [ - "webserver", - "database", - "applications", - "search", - "storage", - "message-queue", - "user", - "search", - "files", - "messages", - "auth", - "channels", - "counter", - "statistics", - "platform-services", - "documents", - ], - }); + platform = await initWithDefaults(); currentUser = await UserApi.getInstance(platform); }); diff --git a/tdrive/backend/node/test/e2e/documents/documents-search.spec.ts b/tdrive/backend/node/test/e2e/documents/documents-search.spec.ts index d002d3407..695fefaa4 100644 --- a/tdrive/backend/node/test/e2e/documents/documents-search.spec.ts +++ b/tdrive/backend/node/test/e2e/documents/documents-search.spec.ts @@ -1,5 +1,5 @@ import { describe, it, expect, afterAll } from "@jest/globals"; -import { init, TestPlatform } from "../setup"; +import { initWithDefaults, TestPlatform } from "../setup"; import UserApi from "../common/user-api"; import { DriveFileMockClass } from "../common/entities/mock_entities"; import { DriveFile } from "../../../src/services/documents/entities/drive-file"; @@ -14,25 +14,7 @@ describe("the Drive Search feature", () => { const uploadedByUserTwo = []; beforeAll(async () => { - platform = await init({ - services: [ - "webserver", - "database", - "applications", - "search", - "storage", - "message-queue", - "user", - "search", - "files", - "messages", - "auth", - "channels", - "statistics", - "platform-services", - "documents", - ], - }); + platform = await initWithDefaults(); }); afterAll(async () => { diff --git a/tdrive/backend/node/test/e2e/documents/documents-tab.spec.ts b/tdrive/backend/node/test/e2e/documents/documents-tab.spec.ts index ee4099fb1..a7a98aa0d 100644 --- a/tdrive/backend/node/test/e2e/documents/documents-tab.spec.ts +++ b/tdrive/backend/node/test/e2e/documents/documents-tab.spec.ts @@ -1,7 +1,7 @@ import { afterAll, beforeEach, describe, expect, it } from "@jest/globals"; import { deserialize } from "class-transformer"; import { AccessInformation } from "../../../src/services/documents/entities/drive-file"; -import { init, TestPlatform } from "../setup"; +import { initWithDefaults, TestPlatform } from "../setup"; import { TestDbService } from "../utils.prepare.db"; import UserApi from "../common/user-api"; @@ -28,26 +28,7 @@ describe("the Drive Tdrive tabs feature", () => { } beforeEach(async () => { - platform = await init({ - services: [ - "webserver", - "database", - "applications", - "search", - "storage", - "message-queue", - "user", - "search", - "files", - "messages", - "auth", - "channels", - "counter", - "statistics", - "platform-services", - "documents", - ], - }); + platform = await initWithDefaults(); currentUser = await UserApi.getInstance(platform); }); diff --git a/tdrive/backend/node/test/e2e/documents/documents.spec.ts b/tdrive/backend/node/test/e2e/documents/documents.spec.ts index 56c106f5b..4ec084fd6 100644 --- a/tdrive/backend/node/test/e2e/documents/documents.spec.ts +++ b/tdrive/backend/node/test/e2e/documents/documents.spec.ts @@ -2,7 +2,7 @@ import { describe, beforeEach, it, expect, afterAll } from "@jest/globals"; import { deserialize } from "class-transformer"; import { File } from "../../../src/services/files/entities/file"; import { ResourceUpdateResponse } from "../../../src/utils/types"; -import { init, TestPlatform } from "../setup"; +import { initWithDefaults, TestPlatform } from "../setup"; import { TestDbService } from "../utils.prepare.db"; import { e2e_createDocumentFile, @@ -21,26 +21,7 @@ describe("the Drive feature", () => { let currentUser: UserApi; beforeEach(async () => { - platform = await init({ - services: [ - "webserver", - "database", - "applications", - "search", - "storage", - "message-queue", - "user", - "search", - "files", - "messages", - "auth", - "channels", - "counter", - "statistics", - "platform-services", - "documents", - ], - }); + platform = await initWithDefaults(); currentUser = await UserApi.getInstance(platform); }); diff --git a/tdrive/backend/node/test/e2e/documents/editing-session.spec.ts b/tdrive/backend/node/test/e2e/documents/editing-session.spec.ts index 3f9660499..f864dd3f9 100644 --- a/tdrive/backend/node/test/e2e/documents/editing-session.spec.ts +++ b/tdrive/backend/node/test/e2e/documents/editing-session.spec.ts @@ -1,6 +1,6 @@ import { describe, beforeAll, beforeEach, it, expect, afterAll, jest } from "@jest/globals"; -import { init, TestPlatform } from "../setup"; +import { initWithDefaults, TestPlatform } from "../setup"; import UserApi from "../common/user-api"; import { DriveFile, TYPE as DriveFileType } from "../../../src/services/documents/entities/drive-file"; @@ -15,28 +15,7 @@ describe("the Drive's documents' editing session kind-of-lock", () => { let temporaryDocument: DriveFile; beforeAll(async () => { - platform = await init({ - services: [ - "webserver", - "database", - "applications", - "search", - "storage", - "message-queue", - "user", - "search", - "files", - "websocket", - "messages", - "auth", - "realtime", - "channels", - "counter", - "statistics", - "platform-services", - "documents", - ], - }); + platform = await initWithDefaults(); currentUser = await UserApi.getInstance(platform); currentUserRoot = `user_${currentUser.user.id}`; }); diff --git a/tdrive/backend/node/test/e2e/documents/my-drive.spec.ts b/tdrive/backend/node/test/e2e/documents/my-drive.spec.ts index c9da81d1e..94b1fd595 100644 --- a/tdrive/backend/node/test/e2e/documents/my-drive.spec.ts +++ b/tdrive/backend/node/test/e2e/documents/my-drive.spec.ts @@ -1,6 +1,6 @@ import { describe, beforeEach, afterEach, it, expect, afterAll } from "@jest/globals"; import { deserialize } from "class-transformer"; -import { init, TestPlatform } from "../setup"; +import { initWithDefaults, TestPlatform } from "../setup"; import { TestDbService } from "../utils.prepare.db"; import { e2e_updateDocument, @@ -21,38 +21,8 @@ describe("the My Drive feature", () => { is_directory: boolean; } - class DriveItemDetailsMockClass { - path: string[]; - item: DriveFileMockClass; - children: DriveFileMockClass[]; - versions: Record[]; - } - - class SearchResultMockClass { - entities: DriveFileMockClass[]; - } - beforeEach(async () => { - platform = await init({ - services: [ - "webserver", - "database", - "applications", - "search", - "storage", - "message-queue", - "user", - "search", - "files", - "messages", - "auth", - "channels", - "counter", - "statistics", - "platform-services", - "documents", - ], - }); + platform = await initWithDefaults(); currentUser = await UserApi.getInstance(platform); }); diff --git a/tdrive/backend/node/test/e2e/documents/public-links.spec.ts b/tdrive/backend/node/test/e2e/documents/public-links.spec.ts index 9be613fd2..901bf921f 100644 --- a/tdrive/backend/node/test/e2e/documents/public-links.spec.ts +++ b/tdrive/backend/node/test/e2e/documents/public-links.spec.ts @@ -35,6 +35,9 @@ describe("the public links feature", () => { beforeAll(async () => { platform = await init({ services: [ + "cron", + "tracker", + "email-pusher", "webserver", "database", "applications", @@ -44,17 +47,16 @@ describe("the public links feature", () => { "user", "search", "files", - "messages", "auth", - "channels", "counter", "statistics", - "platform-services", "documents", + "previews", + "console" ], }); currentUser = await UserApi.getInstance(platform); - }); + }, 300000000); afterAll(async () => { await platform?.tearDown(); @@ -287,6 +289,6 @@ describe("the public links feature", () => { await anotherUser.getDocumentOKCheck(doc.id); expect((await anotherUser.zipDocument(doc.id)).statusCode).toBe(200); - }); + }, 30000000); }); }); diff --git a/tdrive/backend/node/test/e2e/documents/trash.spec.ts b/tdrive/backend/node/test/e2e/documents/trash.spec.ts index 912f78c80..faaabac75 100644 --- a/tdrive/backend/node/test/e2e/documents/trash.spec.ts +++ b/tdrive/backend/node/test/e2e/documents/trash.spec.ts @@ -1,7 +1,7 @@ import { describe, beforeAll, it, expect, afterAll } from "@jest/globals"; import { deserialize } from "class-transformer"; -import { init, TestPlatform } from "../setup"; +import { initWithDefaults, TestPlatform } from "../setup"; import { TestDbService } from "../utils.prepare.db"; import UserApi from "../common/user-api"; import { @@ -15,28 +15,7 @@ describe("the Drive's documents' trash feature", () => { let currentUserTrash: string | undefined; beforeAll(async () => { - platform = await init({ - services: [ - "webserver", - "database", - "applications", - "search", - "storage", - "message-queue", - "user", - "search", - "files", - "websocket", - "messages", - "auth", - "realtime", - "channels", - "counter", - "statistics", - "platform-services", - "documents", - ], - }); + platform = await initWithDefaults(); currentUser = await UserApi.getInstance(platform); currentUserRoot = `user_${currentUser.user.id}`; currentUserTrash = `trash_${currentUser.user.id}`; diff --git a/tdrive/backend/node/test/e2e/files/files.spec.ts b/tdrive/backend/node/test/e2e/files/files.spec.ts index 805df2445..bcba1f22b 100644 --- a/tdrive/backend/node/test/e2e/files/files.spec.ts +++ b/tdrive/backend/node/test/e2e/files/files.spec.ts @@ -1,6 +1,6 @@ import "reflect-metadata"; import { afterAll, beforeAll, afterEach, describe, expect, it } from "@jest/globals"; -import { init, TestPlatform } from "../setup"; +import { initWithDefaults, TestPlatform } from "../setup"; import { getFilePath } from "../../../src/services/files/services"; import UserApi from "../common/user-api"; import LocalConnectorService from "../../../src/core/platform/services/storage/connectors/local/service" @@ -13,9 +13,7 @@ describe("The Files feature", () => { let helpers: UserApi; beforeAll(async () => { - platform = await init({ - services: ["webserver", "database", "storage", "files", "previews"], - }); + platform = await initWithDefaults(); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore await platform.database.getConnector().init(); diff --git a/tdrive/backend/node/test/e2e/files/storage.oneof.spec.ts b/tdrive/backend/node/test/e2e/files/storage.oneof.spec.ts index 41f930bd0..ec2415850 100644 --- a/tdrive/backend/node/test/e2e/files/storage.oneof.spec.ts +++ b/tdrive/backend/node/test/e2e/files/storage.oneof.spec.ts @@ -1,7 +1,7 @@ import "./load_test_config" import "reflect-metadata"; import { afterAll, beforeAll, afterEach, describe, expect, it } from "@jest/globals"; -import { init, TestPlatform } from "../setup"; +import { initWithDefaults, TestPlatform } from "../setup"; import UserApi from "../common/user-api"; import LocalConnectorService from "../../../src/core/platform/services/storage/connectors/local/service" import { StorageConnectorAPI } from "../../../src/core/platform/services/storage/provider"; @@ -12,9 +12,7 @@ describe("The OneOf Storage feature", () => { let helpers: UserApi; beforeAll(async () => { - platform = await init({ - services: ["webserver", "database", "storage", "files", "previews"], - }); + platform = await initWithDefaults(); helpers = await UserApi.getInstance(platform); }); diff --git a/tdrive/backend/node/test/e2e/setup/index.ts b/tdrive/backend/node/test/e2e/setup/index.ts index be53770bf..fd2ee06ea 100644 --- a/tdrive/backend/node/test/e2e/setup/index.ts +++ b/tdrive/backend/node/test/e2e/setup/index.ts @@ -16,6 +16,7 @@ import StorageAPI from "../../../src/core/platform/services/storage/provider"; import {SearchServiceAPI} from "../../../src/core/platform/services/search/api"; import Session from "../../../src/services/console/entities/session"; import EmailPusherAPI from "../../../src/core/platform/services/email-pusher/provider"; +import PreviewsService from "../../../src/services/previews"; type TokenPayload = { sub: string; @@ -48,6 +49,7 @@ export interface TestPlatform { messageQueue: MessageQueueServiceAPI; authService: AuthServiceAPI; filesService: FileServiceImpl; + previews: PreviewsService; auth: { getJWTToken(payload?: TokenPayload): Promise; }; @@ -61,13 +63,44 @@ export interface TestPlatformConfiguration { let testPlatform: TestPlatform = null; +// init platform with default services list +export async function initWithDefaults(): Promise { + return await init({ + services: [ + "auth", + "push", + "storage", + "webserver", + "database", + "cron", + "search", + "message-queue", + "tracker", + "general", + "user", + "files", + "workspaces", + "console", + "previews", + "counter", + "statistics", + "cron", + "email-pusher", + "documents", + "applications", + "applications-api", + "tags" + ], + }); +} + export async function init( testConfig?: TestPlatformConfiguration, prePlatformStartCallback?: (fastify: FastifyInstance) => void, ): Promise { if (!testPlatform) { const configuration: TdrivePlatformConfiguration = { - services: config.get("services"), + services: testConfig.services, servicesPath: pathResolve(__dirname, "../../../src/services/"), }; const platform = new TdrivePlatform(configuration); @@ -89,6 +122,7 @@ export async function init( const storage: StorageAPI = platform.getProvider("storage"); const search: SearchServiceAPI = platform.getProvider("search"); const emailPusher: EmailPusherAPI = platform.getProvider("email-pusher"); + const previews = platform.getProvider("previews") testPlatform = { platform, @@ -107,6 +141,7 @@ export async function init( }, tearDown, search, + previews }; } diff --git a/tdrive/backend/node/test/e2e/tags/tags.spec.ts b/tdrive/backend/node/test/e2e/tags/tags.spec.ts index 78a648b35..56f739803 100644 --- a/tdrive/backend/node/test/e2e/tags/tags.spec.ts +++ b/tdrive/backend/node/test/e2e/tags/tags.spec.ts @@ -1,6 +1,6 @@ import "reflect-metadata"; import { afterAll, beforeAll, describe, expect, it } from "@jest/globals"; -import { init, TestPlatform } from "../setup"; +import { initWithDefaults, TestPlatform } from "../setup"; import { TestDbService } from "../utils.prepare.db"; import { Tag } from "../../../src/services/tags/entities/tags"; import { deserialize } from "class-transformer"; @@ -17,9 +17,7 @@ describe("The Tag feature", () => { const tagIds: string[] = []; beforeAll(async () => { - platform = await init({ - services: ["webserver", "database", "storage", "message-queue", "tags"], - }); + platform = await initWithDefaults(); testDbService = await TestDbService.getInstance(platform, true); }); diff --git a/tdrive/backend/node/test/e2e/users/users.quota.spec.ts b/tdrive/backend/node/test/e2e/users/users.quota.spec.ts index 2bd7947d4..3c3e48e0d 100644 --- a/tdrive/backend/node/test/e2e/users/users.quota.spec.ts +++ b/tdrive/backend/node/test/e2e/users/users.quota.spec.ts @@ -1,5 +1,5 @@ -import { afterAll, afterEach, beforeAll, beforeEach, describe, expect} from "@jest/globals"; -import { init, TestPlatform } from "../setup"; +import { afterAll, afterEach, beforeEach, describe, expect} from "@jest/globals"; +import { init, initWithDefaults, TestPlatform } from "../setup"; import UserApi from "../common/user-api"; describe("The /users/quota API", () => { @@ -7,35 +7,15 @@ describe("The /users/quota API", () => { let currentUser: UserApi; beforeEach(async () => { - platform = await init(); + platform = await initWithDefaults(); currentUser = await UserApi.getInstance(platform); - }, 30000000); + }); afterEach(async () => { await platform.tearDown(); platform = null; }); - beforeAll(async () => { - const platform = await init({ - services: [ - "database", - "search", - "message-queue", - "applications", - "webserver", - "user", - "auth", - "storage", - "counter", - "console", - "workspaces", - "statistics", - "platform-services", - ], - }); - }, 30000000); - afterAll(async () => { }); @@ -51,7 +31,7 @@ describe("The /users/quota API", () => { expect(quota.total).toBe(userQuota); expect(quota.remaining).toBe(userQuota - doc.size); //198346196 //198342406 expect(quota.used).toBe(doc.size); - }, 30000000); + }); test("should return 200 with all empty space", async () => { //given diff --git a/tdrive/backend/node/test/e2e/users/users.search.spec.ts b/tdrive/backend/node/test/e2e/users/users.search.spec.ts index ece0d9c81..32a174ee0 100644 --- a/tdrive/backend/node/test/e2e/users/users.search.spec.ts +++ b/tdrive/backend/node/test/e2e/users/users.search.spec.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, describe, expect, it } from "@jest/globals"; -import { init, TestPlatform } from "../setup"; +import { initWithDefaults, TestPlatform } from "../setup"; import { TestDbService } from "../utils.prepare.db"; import { v1 as uuidv1 } from "uuid"; @@ -8,23 +8,7 @@ describe("The /users API", () => { let platform: TestPlatform; beforeEach(async () => { - platform = await init({ - services: [ - "database", - "search", - "message-queue", - "webserver", - "user", - "auth", - "applications", - "storage", - "counter", - "workspaces", - "console", - "statistics", - "platform-services", - ], - }); + platform = await initWithDefaults(); }); afterEach(async () => { diff --git a/tdrive/backend/node/test/e2e/users/users.spec.ts b/tdrive/backend/node/test/e2e/users/users.spec.ts index 62c7bb5c9..ff6b78c32 100644 --- a/tdrive/backend/node/test/e2e/users/users.spec.ts +++ b/tdrive/backend/node/test/e2e/users/users.spec.ts @@ -1,5 +1,5 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from "@jest/globals"; -import { init, TestPlatform } from "../setup"; +import { init, initWithDefaults, TestPlatform } from "../setup"; import { TestDbService } from "../utils.prepare.db"; import { v1 as uuidv1 } from "uuid"; import { CompanyLimitsEnum } from "../../../src/services/user/web/types"; @@ -22,23 +22,7 @@ describe("The /users API", () => { }); beforeAll(async () => { - const platform = await init({ - services: [ - "database", - "search", - "message-queue", - "applications", - "webserver", - "user", - "auth", - "storage", - "counter", - "console", - "workspaces", - "statistics", - "platform-services", - ], - }); + platform = await initWithDefaults(); testDbService = await TestDbService.getInstance(platform); await testDbService.createCompany(); diff --git a/tdrive/backend/node/test/e2e/workspaces/workspace-users.spec.ts b/tdrive/backend/node/test/e2e/workspaces/workspace-users.spec.ts index dc6d5c211..44f3a35e0 100644 --- a/tdrive/backend/node/test/e2e/workspaces/workspace-users.spec.ts +++ b/tdrive/backend/node/test/e2e/workspaces/workspace-users.spec.ts @@ -1,5 +1,5 @@ import { afterAll, beforeAll, describe, expect, it } from "@jest/globals"; -import { init, TestPlatform } from "../setup"; +import { initWithDefaults, TestPlatform } from "../setup"; import { TestDbService, uuid } from "../utils.prepare.db"; import { v1 as uuidv1 } from "uuid"; @@ -38,23 +38,7 @@ describe("The /workspace users API", () => { }; beforeAll(async () => { - platform = await init({ - services: [ - "database", - "message-queue", - "search", - "webserver", - "user", - "workspaces", - "applications", - "auth", - "console", - "counter", - "storage", - "statistics", - "platform-services", - ], - }); + platform = platform = await initWithDefaults(); companyId = platform.workspace.company_id; diff --git a/tdrive/backend/node/test/e2e/workspaces/workspaces.spec.ts b/tdrive/backend/node/test/e2e/workspaces/workspaces.spec.ts index 327cb4ed8..0690f2290 100644 --- a/tdrive/backend/node/test/e2e/workspaces/workspaces.spec.ts +++ b/tdrive/backend/node/test/e2e/workspaces/workspaces.spec.ts @@ -1,5 +1,5 @@ import { afterAll, beforeAll, describe, expect, it } from "@jest/globals"; -import { init, TestPlatform } from "../setup"; +import { initWithDefaults, TestPlatform } from "../setup"; import { TestDbService } from "../utils.prepare.db"; import { v1 as uuidv1 } from "uuid"; @@ -13,23 +13,7 @@ describe("The /workspaces API", () => { let companyId = ""; beforeAll(async () => { - platform = await init({ - services: [ - "database", - "message-queue", - "webserver", - "user", - "search", - "workspaces", - "auth", - "console", - "counter", - "storage", - "applications", - "statistics", - "platform-services", - ], - }); + platform = await initWithDefaults(); companyId = platform.workspace.company_id;