🔄 Rename all "twake" instances to "tdrive"

🔄 Rename all "twake" instances to "tdrive"
This commit is contained in:
Montassar Ghanmy
2023-04-10 14:12:00 +01:00
committed by GitHub
parent 88cba77421
commit d91a13e2cc
323 changed files with 1021 additions and 1023 deletions
@@ -7,7 +7,7 @@ import { e2e_createDocument, e2e_getDocument } from "./utils";
const url = "/internal/services/documents/v1";
describe("the Drive Twake tabs feature", () => {
describe("the Drive Tdrive tabs feature", () => {
let platform: TestPlatform;
class DriveFileMockClass {
+2 -2
View File
@@ -1,9 +1,9 @@
/**
* To run all tests in local development mode:
* cd twake/; docker-compose -f docker-compose.dev.tests.mongo.yml run -e NODE_OPTIONS=--unhandled-rejections=warn -e SEARCH_DRIVER=mongodb -e DB_DRIVER=mongodb -e PUBSUB_TYPE=local node npm run test:e2e
* cd tdrive/; docker-compose -f docker-compose.dev.tests.mongo.yml run -e NODE_OPTIONS=--unhandled-rejections=warn -e SEARCH_DRIVER=mongodb -e DB_DRIVER=mongodb -e PUBSUB_TYPE=local node npm run test:e2e
*
* To run only specific tests:
* cd twake/; docker-compose -f docker-compose.dev.tests.mongo.yml run -e NODE_OPTIONS=--unhandled-rejections=warn -e SEARCH_DRIVER=mongodb -e DB_DRIVER=mongodb -e PUBSUB_TYPE=local node npm run test:e2e -- test/e2e/application/app-create-update.spec.ts test/e2e/application/application-events.spec.ts
* cd tdrive/; docker-compose -f docker-compose.dev.tests.mongo.yml run -e NODE_OPTIONS=--unhandled-rejections=warn -e SEARCH_DRIVER=mongodb -e DB_DRIVER=mongodb -e PUBSUB_TYPE=local node npm run test:e2e -- test/e2e/application/app-create-update.spec.ts test/e2e/application/application-events.spec.ts
*/
const fs = require("fs");
+4 -4
View File
@@ -1,7 +1,7 @@
import { resolve as pathResolve } from "path";
import { v1 as uuidv1 } from "uuid";
import { FastifyInstance } from "fastify";
import { TwakePlatform, TwakePlatformConfiguration } from "../../../src/core/platform/platform";
import { TdrivePlatform, TdrivePlatformConfiguration } from "../../../src/core/platform/platform";
import WebServerAPI from "../../../src/core/platform/services/webserver/provider";
import { DatabaseServiceAPI } from "../../../src/core/platform/services/database/api";
import AuthServiceAPI from "../../../src/core/platform/services/auth/provider";
@@ -28,7 +28,7 @@ type User = {
export interface TestPlatform {
currentUser: User;
platform: TwakePlatform;
platform: TdrivePlatform;
workspace: Workspace;
app: FastifyInstance;
database: DatabaseServiceAPI;
@@ -51,11 +51,11 @@ export async function init(
prePlatformStartCallback?: (fastify: FastifyInstance) => void,
): Promise<TestPlatform> {
if (!testPlatform) {
const configuration: TwakePlatformConfiguration = {
const configuration: TdrivePlatformConfiguration = {
services: config.get("services"),
servicesPath: pathResolve(__dirname, "../../../src/services/"),
};
const platform = new TwakePlatform(configuration);
const platform = new TdrivePlatform(configuration);
await platform.init();
await globalResolver.doInit(platform);
@@ -52,32 +52,32 @@ describe("The /users API", () => {
await testDbService.createUser([workspacePk], {
firstName: "Ha",
lastName: "Nguyen",
email: "hnguyen@twake.app",
email: "hnguyen@tdrive.app",
});
await testDbService.createUser([workspacePk], {
firstName: "Harold",
lastName: "Georges",
email: "hgeorges@twake.app",
email: "hgeorges@tdrive.app",
});
await testDbService.createUser([workspacePk], {
firstName: "Bob",
lastName: "Smith",
email: "bob@twake.app",
email: "bob@tdrive.app",
});
await testDbService.createUser([workspacePk], {
firstName: "Bob",
lastName: "Rabiot",
email: "rabiot.b@twake.app",
email: "rabiot.b@tdrive.app",
});
await testDbService.createUser([workspacePk, workspacePk2], {
firstName: "Bob",
lastName: "Smith-Rabiot",
email: "rbs@twake.app",
email: "rbs@tdrive.app",
});
await testDbService.createUser([workspacePk], {
firstName: "Alexïs",
lastName: "Goélâns",
email: "alexis.goelans@twake.app",
email: "alexis.goelans@tdrive.app",
});
//Wait for indexation to happen
@@ -88,38 +88,38 @@ describe("The /users API", () => {
resources = await search("bob rabiot");
expect(resources.map(e => e.email).includes("rabiot.b@twake.app")).toBe(true);
expect(resources.map(e => e.email).includes("rbs@twake.app")).toBe(true);
expect(resources.map(e => e.email).includes("bob@twake.app")).toBe(true);
expect(resources.map(e => e.email).includes("rabiot.b@tdrive.app")).toBe(true);
expect(resources.map(e => e.email).includes("rbs@tdrive.app")).toBe(true);
expect(resources.map(e => e.email).includes("bob@tdrive.app")).toBe(true);
resources = await search("alexis");
expect(resources[0].email).toBe("alexis.goelans@twake.app");
expect(resources[0].email).toBe("alexis.goelans@tdrive.app");
resources = await search("ALEXIS");
expect(resources[0].email).toBe("alexis.goelans@twake.app");
expect(resources[0].email).toBe("alexis.goelans@tdrive.app");
resources = await search("AleXis");
expect(resources[0].email).toBe("alexis.goelans@twake.app");
expect(resources[0].email).toBe("alexis.goelans@tdrive.app");
resources = await search("alex");
expect(resources[0].email).toBe("alexis.goelans@twake.app");
expect(resources[0].email).toBe("alexis.goelans@tdrive.app");
resources = await search("àlèXïs");
expect(resources[0].email).toBe("alexis.goelans@twake.app");
expect(resources[0].email).toBe("alexis.goelans@tdrive.app");
resources = await search("rbs");
expect(resources[0].email).toBe("rbs@twake.app");
expect(resources[0].email).toBe("rbs@tdrive.app");
resources = await search("rbs@twake.app");
expect(resources[0].email).toBe("rbs@twake.app");
resources = await search("rbs@tdrive.app");
expect(resources[0].email).toBe("rbs@tdrive.app");
resources = await search("bob", workspacePk2.company_id);
expect(resources.length).toBe(1);
resources = await search("rbs@twake.app", workspacePk.company_id);
expect(resources[0].email).toBe("rbs@twake.app");
resources = await search("rbs@tdrive.app", workspacePk.company_id);
expect(resources[0].email).toBe("rbs@tdrive.app");
resources = await search("rbs@twake.app", uuidv1());
resources = await search("rbs@tdrive.app", uuidv1());
expect(resources.length).toBe(0);
done();
@@ -71,7 +71,7 @@ export class TestDbService {
async createCompany(id?: uuid, name?: string): Promise<Company> {
if (!name) {
name = `TwakeAutotests-test-company-${this.rand()}`;
name = `TdriveAutotests-test-company-${this.rand()}`;
}
this.company = await gr.services.companies.createCompany(
getCompanyInstance({
@@ -86,7 +86,7 @@ export class TestDbService {
async createWorkspace(
workspacePk: WorkspacePrimaryKey,
name = `TwakeAutotests-test-workspace-${this.rand()}`,
name = `TdriveAutotests-test-workspace-${this.rand()}`,
): Promise<Workspace> {
if (!workspacePk.company_id) throw new Error("company_id is not defined for workspace");
@@ -137,7 +137,7 @@ export class TestDbService {
user.username_canonical = options.username || `test${random}`;
user.first_name = options.firstName || `test${random}_first_name`;
user.last_name = options.lastName || `test${random}_last_name`;
user.email_canonical = options.email || `test${random}@twake.app`;
user.email_canonical = options.email || `test${random}@tdrive.app`;
user.identity_provider_id = user.id;
user.cache = options.cache || user.cache || { companies: [] };
@@ -22,9 +22,9 @@ Authorization: Bearer {{authToken}}
{
"resource": {
"name": "My channel",
"icon": "twake logo",
"description": "This channel allow twake's team to chat easily",
"channel_group": "twake",
"icon": "tdrive logo",
"description": "This channel allow tdrive's team to chat easily",
"channel_group": "tdrive",
"visibility": "public",
"is_default": true,
"archived": false
+3 -3
View File
@@ -35,9 +35,9 @@ Authorization: Bearer {{authToken}}
{
"resource": {
"name": "My channel",
"icon": "twake logo",
"description": "This channel allow twake's team to chat easily",
"channel_group": "twake",
"icon": "tdrive logo",
"description": "This channel allow tdrive's team to chat easily",
"channel_group": "tdrive",
"visibility": "public",
"is_default": true,
"archived": false
@@ -45,7 +45,7 @@ Authorization: Bearer {{authToken1}}
"resource": {
"icon": "hello",
"description": "A direct channel",
"channel_group": "twake",
"channel_group": "tdrive",
"is_default": false,
"archived": false
}
@@ -30,9 +30,9 @@ Authorization: Bearer {{authTokenUser1}}
{
"resource": {
"name": "My private channel",
"icon": "twake logo",
"description": "This channel allow twake's team to chat easily",
"channel_group": "twake",
"icon": "tdrive logo",
"description": "This channel allow tdrive's team to chat easily",
"channel_group": "tdrive",
"visibility": "private",
"is_default": true,
"archived": false
@@ -35,9 +35,9 @@ Authorization: Bearer {{authToken}}
{
"resource": {
"name": "My private channel",
"icon": "twake logo",
"icon": "tdrive logo",
"description": "A private channel",
"channel_group": "twake",
"channel_group": "tdrive",
"visibility": "private",
"is_default": true,
"archived": false
@@ -30,9 +30,9 @@ Authorization: Bearer {{authTokenUser1}}
{
"resource": {
"name": "A public channel",
"icon": "twake logo",
"description": "This channel allow twake's team to chat easily",
"channel_group": "twake",
"icon": "tdrive logo",
"description": "This channel allow tdrive's team to chat easily",
"channel_group": "tdrive",
"visibility": "public",
"is_default": true,
"archived": false
+3 -3
View File
@@ -29,9 +29,9 @@ Authorization: Bearer {{authToken}}
{
"resource": {
"name": "My channel",
"icon": "twake logo",
"description": "This channel allow twake's team to chat easily",
"channel_group": "twake",
"icon": "tdrive logo",
"description": "This channel allow tdrive's team to chat easily",
"channel_group": "tdrive",
"visibility": "public",
"is_default": true,
"archived": false
@@ -18,11 +18,11 @@ describe("The QueryBuilder module", () => {
ChannelMemberNotificationPreference,
filters,
{},
{ keyspace: "twake" },
{ keyspace: "tdrive" },
);
expect(result).toEqual(
"SELECT * FROM twake.channel_members_notification_preferences WHERE company_id = comp1 AND channel_id = chan1;",
"SELECT * FROM tdrive.channel_members_notification_preferences WHERE company_id = comp1 AND channel_id = chan1;",
);
});
@@ -37,11 +37,11 @@ describe("The QueryBuilder module", () => {
{
$lt: [["last_read", 1000]],
},
{ keyspace: "twake" },
{ keyspace: "tdrive" },
);
expect(result).toEqual(
"SELECT * FROM twake.channel_members_notification_preferences WHERE company_id = comp1 AND channel_id = chan1 AND last_read < 1000;",
"SELECT * FROM tdrive.channel_members_notification_preferences WHERE company_id = comp1 AND channel_id = chan1 AND last_read < 1000;",
);
});
@@ -55,11 +55,11 @@ describe("The QueryBuilder module", () => {
ChannelMemberNotificationPreference,
filters,
{},
{ keyspace: "twake" },
{ keyspace: "tdrive" },
);
expect(result).toEqual(
"SELECT * FROM twake.channel_members_notification_preferences WHERE company_id = comp1 AND channel_id = chan1 AND user_id IN (u1,u2,u3);",
"SELECT * FROM tdrive.channel_members_notification_preferences WHERE company_id = comp1 AND channel_id = chan1 AND user_id IN (u1,u2,u3);",
);
});
@@ -73,11 +73,11 @@ describe("The QueryBuilder module", () => {
ChannelMemberNotificationPreference,
filters,
{},
{ keyspace: "twake" },
{ keyspace: "tdrive" },
);
expect(result).toEqual(
"SELECT * FROM twake.channel_members_notification_preferences WHERE company_id = comp1 AND channel_id = chan1;",
"SELECT * FROM tdrive.channel_members_notification_preferences WHERE company_id = comp1 AND channel_id = chan1;",
);
});
});