From 530b2be38200fc1be8f8b4ff276d86622806b43b Mon Sep 17 00:00:00 2001 From: VitoAlbano Date: Tue, 6 Aug 2024 00:52:07 +0100 Subject: [PATCH] [MIGRATION] - Solving a funny comment issue part 2 --- .../directives/node-restore.directive.spec.ts | 2 +- .../tags-creator/tags-creator.component.ts | 6 ++- .../lib/services/storage-features.service.ts | 49 +++++++++++++------ .../identity/group-identity.service.ts | 35 ++++++++----- .../lib/protractor/core/pages/login.page.ts | 3 +- 5 files changed, 64 insertions(+), 31 deletions(-) diff --git a/lib/content-services/src/lib/directives/node-restore.directive.spec.ts b/lib/content-services/src/lib/directives/node-restore.directive.spec.ts index 2dd5c9fff7..2020d16b41 100644 --- a/lib/content-services/src/lib/directives/node-restore.directive.spec.ts +++ b/lib/content-services/src/lib/directives/node-restore.directive.spec.ts @@ -133,7 +133,7 @@ describe('NodeRestoreDirective', () => { describe('notification', () => { it('should notify on multiple fails', (done) => { - const error = { message: '{ "error": { /* empty */ } }' }; + const error = { message: '{ "error": { } }' }; directiveInstance.restore.subscribe((event: any) => { expect(event.message).toEqual('CORE.RESTORE_NODE.PARTIAL_PLURAL'); diff --git a/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.ts b/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.ts index 22886a9f7e..d0221c4d54 100644 --- a/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.ts +++ b/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.ts @@ -176,7 +176,9 @@ export class TagsCreatorComponent implements OnInit, OnDestroy { @ViewChild('tagNameInput') private tagNameInputElement: ElementRef; - constructor(private tagService: TagService, private notificationService: NotificationService) { /* empty */ } + constructor(private tagService: TagService, private notificationService: NotificationService) { + /* empty */ + } ngOnInit(): void { this.tagNameControl.valueChanges @@ -374,7 +376,7 @@ export class TagsCreatorComponent implements OnInit, OnDestroy { } private validateSpecialCharacters(tagNameControl: FormControl): TagNameControlErrors | null { - const specialSymbolsRegex = /[{ /* empty */ }()^':"\\|<>/?]/; + const specialSymbolsRegex = /[{}()^':"\\|<>/?]/; return tagNameControl.value.length && specialSymbolsRegex.test(tagNameControl.value) ? { specialCharacters: true } : null; } diff --git a/lib/core/feature-flags/src/lib/services/storage-features.service.ts b/lib/core/feature-flags/src/lib/services/storage-features.service.ts index d218ae8b59..670d612470 100644 --- a/lib/core/feature-flags/src/lib/services/storage-features.service.ts +++ b/lib/core/feature-flags/src/lib/services/storage-features.service.ts @@ -32,8 +32,12 @@ import { StorageService } from '@alfresco/adf-core'; @Injectable() export class StorageFeaturesService implements IFeaturesService, IWritableFeaturesService { - private currentFlagState: WritableFlagChangeset = { /* empty */ }; - private flags = new BehaviorSubject({ /* empty */ }); + private currentFlagState: WritableFlagChangeset = { + /* empty */ + }; + private flags = new BehaviorSubject({ + /* empty */ + }); private flags$ = this.flags.asObservable(); constructor( @@ -51,7 +55,7 @@ export class StorageFeaturesService implements IFeaturesService, IWritableFeatur } init(): Observable { - const storedFlags = JSON.parse(this.storageService.getItem(this.storageKey) || '{ /* empty */ }'); + const storedFlags = JSON.parse(this.storageService.getItem(this.storageKey) || '{}'); const initialFlagChangeSet = FlagSetParser.deserialize(storedFlags); this.flags.next(initialFlagChangeSet); return of(initialFlagChangeSet); @@ -70,11 +74,17 @@ export class StorageFeaturesService implements IFeaturesService, IWritableFeatur } setFlag(key: string, value: any): void { - let fictive = { /* empty */ }; + let fictive = { + /* empty */ + }; if (!this.currentFlagState[key]) { fictive = { fictive: true }; } else { - fictive = this.currentFlagState[key]?.fictive ? { fictive: true } : { /* empty */ }; + fictive = this.currentFlagState[key]?.fictive + ? { fictive: true } + : { + /* empty */ + }; } this.flags.next({ @@ -104,22 +114,29 @@ export class StorageFeaturesService implements IFeaturesService, IWritableFeatur fictive: true } }), - { /* empty */ } + { + /* empty */ + } ) ); } mergeFlags(flags: FlagChangeset): void { - const mergedFlags: WritableFlagChangeset = Object.keys(flags).reduce((acc, key) => { - const current = this.currentFlagState[key]?.current; - return { - ...acc, - [key]: { - current: current ?? flags[key].current, - previous: current ?? null - } - }; - }, { /* empty */ }); + const mergedFlags: WritableFlagChangeset = Object.keys(flags).reduce( + (acc, key) => { + const current = this.currentFlagState[key]?.current; + return { + ...acc, + [key]: { + current: current ?? flags[key].current, + previous: current ?? null + } + }; + }, + { + /* empty */ + } + ); Object.keys(this.currentFlagState) .filter((key) => !flags[key]) diff --git a/lib/testing/src/lib/protractor/core/actions/identity/group-identity.service.ts b/lib/testing/src/lib/protractor/core/actions/identity/group-identity.service.ts index a9085b9460..63f8d1e6df 100644 --- a/lib/testing/src/lib/protractor/core/actions/identity/group-identity.service.ts +++ b/lib/testing/src/lib/protractor/core/actions/identity/group-identity.service.ts @@ -22,7 +22,6 @@ import { Logger } from '../../utils/logger'; import { browser } from 'protractor'; export class GroupIdentityService { - api: ApiService; constructor(api: ApiService) { @@ -42,7 +41,9 @@ export class GroupIdentityService { async createGroup(groupName: string): Promise { const path = '/groups'; const method = 'POST'; - const queryParams = { /* empty */ }; + const queryParams = { + /* empty */ + }; const postBody = { name: `${groupName}-${browser.params.groupSuffix}` }; @@ -53,8 +54,12 @@ export class GroupIdentityService { async deleteGroup(groupId: string): Promise { const path = `/groups/${groupId}`; const method = 'DELETE'; - const queryParams = { /* empty */ }; - const postBody = { /* empty */ }; + const queryParams = { + /* empty */ + }; + const postBody = { + /* empty */ + }; const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); return data; } @@ -69,15 +74,18 @@ export class GroupIdentityService { const path = `/groups`; const method = 'GET'; const queryParams = { search: groupName }; - const postBody = { /* empty */ }; + const postBody = { + /* empty */ + }; const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); Logger.log(`Data ${JSON.stringify(data)}`); - return data[0]; Logger.error('Group not found'); - + return data[0]; + Logger.error('Group not found'); } catch (error) { + /* ignore */ } }; @@ -89,7 +97,9 @@ export class GroupIdentityService { const path = `/groups/${groupId}/role-mappings/realm`; const method = 'POST'; - const queryParams = { /* empty */ }; + const queryParams = { + /* empty */ + }; const postBody = [{ id: roleId, name: roleName }]; const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); @@ -107,7 +117,9 @@ export class GroupIdentityService { async addClientRole(groupId: string, clientId: string, roleId: string, roleName: string): Promise { const path = `/groups/${groupId}/role-mappings/clients/${clientId}`; const method = 'POST'; - const queryParams = { /* empty */ }; + const queryParams = { + /* empty */ + }; const postBody = [ { id: roleId, @@ -130,10 +142,11 @@ export class GroupIdentityService { const path = `/clients`; const method = 'GET'; const queryParams = { clientId: applicationName }; - const postBody = { /* empty */ }; + const postBody = { + /* empty */ + }; const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); return data[0].id; } - } diff --git a/lib/testing/src/lib/protractor/core/pages/login.page.ts b/lib/testing/src/lib/protractor/core/pages/login.page.ts index 934fb02bab..dd5bcb62d5 100644 --- a/lib/testing/src/lib/protractor/core/pages/login.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/login.page.ts @@ -43,6 +43,7 @@ export class LoginPage { try { currentUrl = await browser.getCurrentUrl(); } catch (e) { + /* empty */ } if (!currentUrl || currentUrl.indexOf(this.loginUrl) === -1) { @@ -87,7 +88,7 @@ export class LoginPage { if (oauth2 && oauth2.silentLogin === false) { Logger.log(`Login SSO`); await this.clickOnSSOButton(); - }else{ + } else { Logger.log(`Login SSO silent login`); }