🕹 Manage root users

🕹 Manage root users
This commit is contained in:
Montassar Ghanmy
2023-08-28 09:23:52 +01:00
committed by GitHub
parent 832ab8ac90
commit 84270a31e2
29 changed files with 410 additions and 45 deletions
@@ -39,12 +39,12 @@ export default class TestHelpers {
this.platform = platform
}
private async init(newUser: boolean) {
private async init(newUser: boolean, options?: {}) {
this.dbService = await TestDbService.getInstance(this.platform, true);
if (newUser) {
this.workspace = this.platform.workspace;
const workspacePK = {id: this.workspace.workspace_id, company_id: this.workspace.company_id};
this.user = await this.dbService.createUser([workspacePK], {}, uuidv1());
this.user = await this.dbService.createUser([workspacePK], options, uuidv1());
} else {
this.user = this.platform.currentUser;
this.workspace = this.platform.workspace;
@@ -52,9 +52,9 @@ export default class TestHelpers {
this.jwt = this.getJWTTokenForUser(this.user.id);
}
public static async getInstance(platform: TestPlatform, newUser = false): Promise<TestHelpers> {
public static async getInstance(platform: TestPlatform, newUser = false, options?: {}): Promise<TestHelpers> {
const helpers = new TestHelpers(platform);
await helpers.init(newUser)
await helpers.init(newUser, options)
return helpers;
}