diff --git a/lib/content-services/src/lib/webscript/webscript.component.spec.ts b/lib/content-services/src/lib/webscript/webscript.component.spec.ts index 8cc87a23cb8..86c4355c071 100644 --- a/lib/content-services/src/lib/webscript/webscript.component.spec.ts +++ b/lib/content-services/src/lib/webscript/webscript.component.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { ComponentFixture, TestBed, async } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { AppConfigService, setupTestBed } from '@alfresco/adf-core'; import { WebscriptComponent } from './webscript.component'; import { ContentTestingModule } from '../testing/content.testing.module'; @@ -36,7 +36,7 @@ describe('WebscriptComponent', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { const appConfig: AppConfigService = TestBed.inject(AppConfigService); appConfig.config.ecmHost = 'http://localhost:9876/ecm'; @@ -48,7 +48,7 @@ describe('WebscriptComponent', () => { component.scriptPath = 'fakePath'; component.showData = true; fixture.detectChanges(); - })); + }); describe('View', () => { it('html wrapper should be present', () => { diff --git a/lib/content-services/src/lib/webscript/webscript.component.ts b/lib/content-services/src/lib/webscript/webscript.component.ts index 87bd39a7248..e45692854fe 100644 --- a/lib/content-services/src/lib/webscript/webscript.component.ts +++ b/lib/content-services/src/lib/webscript/webscript.component.ts @@ -89,7 +89,7 @@ export class WebscriptComponent implements OnChanges { this.clean(); } - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { this.apiService.getInstance().webScript.executeWebScript('GET', this.scriptPath, this.scriptArgs, this.contextRoot, this.servicePath).then((webScriptData) => { this.data = webScriptData; diff --git a/lib/core/app-config/app-config.service.spec.ts b/lib/core/app-config/app-config.service.spec.ts index 095a13308fe..9458ddf5fee 100644 --- a/lib/core/app-config/app-config.service.spec.ts +++ b/lib/core/app-config/app-config.service.spec.ts @@ -21,7 +21,9 @@ import { AppConfigService } from './app-config.service'; import { AppConfigModule } from './app-config.module'; import { ExtensionConfig, ExtensionService } from '@alfresco/adf-extensions'; import { of } from 'rxjs'; +import { Injectable } from '@angular/core'; +@Injectable({ providedIn: 'root' }) class TestExtensionService extends ExtensionService { onSetup(config: ExtensionConfig) { diff --git a/lib/core/card-view/components/card-view-item-dispatcher/card-view-item-dispatcher.component.spec.ts b/lib/core/card-view/components/card-view-item-dispatcher/card-view-item-dispatcher.component.spec.ts index f2b42b5d206..78f5788e3f7 100644 --- a/lib/core/card-view/components/card-view-item-dispatcher/card-view-item-dispatcher.component.spec.ts +++ b/lib/core/card-view/components/card-view-item-dispatcher/card-view-item-dispatcher.component.spec.ts @@ -18,7 +18,7 @@ /* tslint:disable:component-selector */ import { Component, Input, SimpleChange } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { CardViewItem } from '../../interfaces/card-view-item.interface'; import { CardItemTypeService } from '../../services/card-item-types.service'; @@ -40,7 +40,7 @@ describe('CardViewItemDispatcherComponent', () => { let cardItemTypeService: CardItemTypeService; let component: CardViewItemDispatcherComponent; - beforeEach(async(() => { + beforeEach(() => { cardItemTypeService = new CardItemTypeService(); cardItemTypeService.setComponentTypeResolver('shiny-custom-element', () => CardViewShinyCustomElementItemComponent); @@ -54,7 +54,7 @@ describe('CardViewItemDispatcherComponent', () => { }); TestBed.compileComponents(); - })); + }); beforeEach(() => { fixture = TestBed.createComponent(CardViewItemDispatcherComponent); diff --git a/lib/core/datatable/components/json-cell/json-cell.component.spec.ts b/lib/core/datatable/components/json-cell/json-cell.component.spec.ts index 454e6feac2a..3c6cd4efa4f 100644 --- a/lib/core/datatable/components/json-cell/json-cell.component.spec.ts +++ b/lib/core/datatable/components/json-cell/json-cell.component.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ObjectDataTableAdapter } from '../../data/object-datatable-adapter'; import { ObjectDataColumn } from '../../data/object-datacolumn.model'; @@ -28,8 +28,8 @@ describe('JsonCellComponent', () => { let component: JsonCellComponent; let fixture: ComponentFixture; let dataTableAdapter: ObjectDataTableAdapter; - let rowData; - let columnData; + let rowData: any; + let columnData: any; setupTestBed({ imports: [ @@ -38,10 +38,10 @@ describe('JsonCellComponent', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { fixture = TestBed.createComponent(JsonCellComponent); component = fixture.componentInstance; - })); + }); beforeEach(() => { rowData = { diff --git a/lib/core/datatable/components/location-cell/location-cell.component.spec.ts b/lib/core/datatable/components/location-cell/location-cell.component.spec.ts index 1bed3fa4cc1..72776a8a9ad 100644 --- a/lib/core/datatable/components/location-cell/location-cell.component.spec.ts +++ b/lib/core/datatable/components/location-cell/location-cell.component.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ObjectDataTableAdapter } from '../../data/object-datatable-adapter'; import { ObjectDataColumn } from '../../data/object-datacolumn.model'; @@ -28,8 +28,8 @@ describe('LocationCellComponent', () => { let component: LocationCellComponent; let fixture: ComponentFixture; let dataTableAdapter: ObjectDataTableAdapter; - let rowData; - let columnData; + let rowData: any; + let columnData: any; setupTestBed({ imports: [ @@ -38,10 +38,10 @@ describe('LocationCellComponent', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { fixture = TestBed.createComponent(LocationCellComponent); component = fixture.componentInstance; - })); + }); beforeEach(() => { rowData = { diff --git a/lib/core/form/components/form-list.component.spec.ts b/lib/core/form/components/form-list.component.spec.ts index 7f442b6c0a2..1e7a12464f6 100644 --- a/lib/core/form/components/form-list.component.spec.ts +++ b/lib/core/form/components/form-list.component.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { of } from 'rxjs'; import { FormService } from '../services/form.service'; import { FormListComponent } from './form-list.component'; @@ -28,7 +28,7 @@ describe('TaskAttachmentList', () => { let component: FormListComponent; let fixture: ComponentFixture; let service: FormService; - let element: any; + let element: HTMLElement; setupTestBed({ imports: [ @@ -37,14 +37,12 @@ describe('TaskAttachmentList', () => { ] }); - beforeEach(async(() => { - + beforeEach(() => { fixture = TestBed.createComponent(FormListComponent); component = fixture.componentInstance; element = fixture.debugElement.nativeElement; service = TestBed.inject(FormService); - - })); + }); it('should show the forms as a list', async () => { spyOn(service, 'getForms').and.returnValue(of([ diff --git a/lib/core/form/components/widgets/content/content.widget.spec.ts b/lib/core/form/components/widgets/content/content.widget.spec.ts index 528454ef4c4..41ef62d14e9 100644 --- a/lib/core/form/components/widgets/content/content.widget.spec.ts +++ b/lib/core/form/components/widgets/content/content.widget.spec.ts @@ -16,7 +16,7 @@ */ import { SimpleChange } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { ContentService } from '../../../../services'; import { of } from 'rxjs'; @@ -69,10 +69,10 @@ describe('ContentWidgetComponent', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { serviceContent = TestBed.inject(ContentService); processContentService = TestBed.inject(ProcessContentService); - })); + }); beforeEach(() => { fixture = TestBed.createComponent(ContentWidgetComponent); diff --git a/lib/core/form/components/widgets/dropdown/dropdown.widget.spec.ts b/lib/core/form/components/widgets/dropdown/dropdown.widget.spec.ts index 3d1023d3890..c5b6f4fb776 100644 --- a/lib/core/form/components/widgets/dropdown/dropdown.widget.spec.ts +++ b/lib/core/form/components/widgets/dropdown/dropdown.widget.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { Observable, of } from 'rxjs'; import { FormService } from '../../../services/form.service'; @@ -54,14 +54,14 @@ describe('DropdownWidgetComponent', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { fixture = TestBed.createComponent(DropdownWidgetComponent); widget = fixture.componentInstance; element = fixture.nativeElement; formService = TestBed.inject(FormService); visibilityService = TestBed.inject(WidgetVisibilityService); widget.field = new FormFieldModel(new FormModel()); - })); + }); it('should require field with restUrl', () => { spyOn(formService, 'getRestFieldValues').and.stub(); @@ -125,12 +125,12 @@ describe('DropdownWidgetComponent', () => { describe('when is required', () => { - beforeEach(async(() => { + beforeEach(() => { widget.field = new FormFieldModel( new FormModel({ taskId: '' }), { type: FormFieldTypes.DROPDOWN, required: true }); - })); + }); it('should be able to display label with asterix', async () => { const label = 'MyLabel123'; @@ -165,7 +165,7 @@ describe('DropdownWidgetComponent', () => { describe('and dropdown is populated via taskId', () => { - beforeEach(async(() => { + beforeEach(() => { spyOn(visibilityService, 'refreshVisibility').and.stub(); spyOn(formService, 'getRestFieldValues').and.callFake(() => { return of(fakeOptionList); @@ -180,7 +180,7 @@ describe('DropdownWidgetComponent', () => { widget.field.emptyOption = { id: 'empty', name: 'Choose one...' }; widget.field.isVisible = true; fixture.detectChanges(); - })); + }); it('should show visible dropdown widget', async () => { expect(element.querySelector('#dropdown-id')).toBeDefined(); @@ -228,7 +228,7 @@ describe('DropdownWidgetComponent', () => { describe('and dropdown is populated via processDefinitionId', () => { - beforeEach(async(() => { + beforeEach(() => { spyOn(visibilityService, 'refreshVisibility').and.stub(); spyOn(formService, 'getRestFieldValuesByProcessId').and.callFake(() => { return of(fakeOptionList); @@ -243,7 +243,7 @@ describe('DropdownWidgetComponent', () => { widget.field.emptyOption = { id: 'empty', name: 'Choose one...' }; widget.field.isVisible = true; fixture.detectChanges(); - })); + }); it('should show visible dropdown widget', () => { expect(element.querySelector('#dropdown-id')).toBeDefined(); diff --git a/lib/core/form/components/widgets/tabs/tabs.widget.spec.ts b/lib/core/form/components/widgets/tabs/tabs.widget.spec.ts index c1924ceefba..de01fda5965 100644 --- a/lib/core/form/components/widgets/tabs/tabs.widget.spec.ts +++ b/lib/core/form/components/widgets/tabs/tabs.widget.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { tick, fakeAsync, async, ComponentFixture, TestBed, flush } from '@angular/core/testing'; +import { tick, fakeAsync, ComponentFixture, TestBed, flush } from '@angular/core/testing'; import { fakeFormJson } from '../../../../mock'; import { FormFieldModel } from '../core/form-field.model'; import { FormModel } from '../core/form.model'; @@ -88,7 +88,7 @@ describe('TabsWidgetComponent', () => { let fakeTabVisible: TabModel; let fakeTabInvisible: TabModel; - beforeEach(async(() => { + beforeEach(() => { fixture = TestBed.createComponent(TabsWidgetComponent); tabWidgetComponent = fixture.componentInstance; element = fixture.nativeElement; @@ -105,7 +105,7 @@ describe('TabsWidgetComponent', () => { fakeTabInvisible.isVisible = false; tabWidgetComponent.tabs.push(fakeTabVisible); tabWidgetComponent.tabs.push(fakeTabInvisible); - })); + }); it('should show only visible tabs', fakeAsync(() => { fixture.detectChanges(); diff --git a/lib/core/login/components/login-dialog-panel.component.spec.ts b/lib/core/login/components/login-dialog-panel.component.spec.ts index ee6b607eb16..599121c1906 100644 --- a/lib/core/login/components/login-dialog-panel.component.spec.ts +++ b/lib/core/login/components/login-dialog-panel.component.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { AuthenticationService } from '../../services/authentication.service'; import { LoginDialogPanelComponent } from './login-dialog-panel.component'; import { of } from 'rxjs'; @@ -26,8 +26,9 @@ import { TranslateModule } from '@ngx-translate/core'; describe('LoginDialogPanelComponent', () => { let component: LoginDialogPanelComponent; let fixture: ComponentFixture; - let element: any; - let usernameInput, passwordInput; + let element: HTMLElement; + let usernameInput: HTMLInputElement; + let passwordInput: HTMLInputElement; let authService: AuthenticationService; setupTestBed({ @@ -37,23 +38,24 @@ describe('LoginDialogPanelComponent', () => { ] }); - beforeEach(async(() => { + beforeEach(async () => { fixture = TestBed.createComponent(LoginDialogPanelComponent); element = fixture.nativeElement; component = fixture.componentInstance; authService = TestBed.inject(AuthenticationService); + fixture.detectChanges(); - fixture.whenStable().then(() => { - usernameInput = element.querySelector('#username'); - passwordInput = element.querySelector('#password'); - }); - })); + await fixture.whenStable(); + + usernameInput = element.querySelector('#username'); + passwordInput = element.querySelector('#password'); + }); afterEach(() => { fixture.destroy(); }); - function loginWithCredentials(username, password) { + function loginWithCredentials(username: string, password: string) { usernameInput.value = username; passwordInput.value = password; diff --git a/lib/core/notifications/components/notification-history.component.spec.ts b/lib/core/notifications/components/notification-history.component.spec.ts index 8cde7d865e6..62631ea7809 100644 --- a/lib/core/notifications/components/notification-history.component.spec.ts +++ b/lib/core/notifications/components/notification-history.component.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed } from '@angular/core/testing'; import { setupTestBed } from '../../testing/setup-test-bed'; import { CoreTestingModule } from '../../testing/core.testing.module'; import { NotificationHistoryComponent } from './notification-history.component'; @@ -48,7 +48,7 @@ describe('Notification History Component', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { fixture = TestBed.createComponent(NotificationHistoryComponent); component = fixture.componentInstance; element = fixture.nativeElement; @@ -56,7 +56,7 @@ describe('Notification History Component', () => { storage = TestBed.inject(StorageService); notificationService = TestBed.inject(NotificationService); component.notifications = []; - })); + }); beforeEach(inject([OverlayContainer], (oc: OverlayContainer) => { overlayContainerElement = oc.getContainerElement(); diff --git a/lib/core/pipes/decimal-number.pipe.spec.ts b/lib/core/pipes/decimal-number.pipe.spec.ts index a66763c7f2f..6ea3ded3dd0 100644 --- a/lib/core/pipes/decimal-number.pipe.spec.ts +++ b/lib/core/pipes/decimal-number.pipe.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, TestBed } from '@angular/core/testing'; +import { TestBed } from '@angular/core/testing'; import { AppConfigService } from '../app-config/app-config.service'; import { UserPreferencesService } from '../services/user-preferences.service'; import { of } from 'rxjs'; @@ -36,11 +36,11 @@ describe('DecimalNumberPipe', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { userPreferences = TestBed.inject(UserPreferencesService); spyOn(userPreferences, 'select').and.returnValue(of('')); pipe = new DecimalNumberPipe(userPreferences, TestBed.inject(AppConfigService)); - })); + }); it('should return number localized and rounded following the default config', () => { expect(pipe.transform(1234.567)).toBe('1,234.57'); diff --git a/lib/core/pipes/file-type.pipe.spec.ts b/lib/core/pipes/file-type.pipe.spec.ts index 61a6078eb42..f5f7be9b40f 100644 --- a/lib/core/pipes/file-type.pipe.spec.ts +++ b/lib/core/pipes/file-type.pipe.spec.ts @@ -16,16 +16,15 @@ */ import { FileTypePipe } from './file-type.pipe'; -import { async } from '@angular/core/testing'; describe('FileTypePipe', () => { const altText = 'ft_ic_ms_word'; let pipe: FileTypePipe; - beforeEach(async(() => { + beforeEach(() => { pipe = new FileTypePipe(); - })); + }); it('should return file type from alt text', () => { expect(pipe.transform(altText)).toBe('word'); diff --git a/lib/core/pipes/full-name.pipe.spec.ts b/lib/core/pipes/full-name.pipe.spec.ts index 9206fd33ed4..eae0c58102b 100644 --- a/lib/core/pipes/full-name.pipe.spec.ts +++ b/lib/core/pipes/full-name.pipe.spec.ts @@ -16,15 +16,14 @@ */ import { FullNamePipe } from './full-name.pipe'; -import { async } from '@angular/core/testing'; describe('FullNamePipe', () => { let pipe: FullNamePipe; - beforeEach(async(() => { + beforeEach(() => { pipe = new FullNamePipe(); - })); + }); it('should return empty string when there is no name', () => { const user = {}; diff --git a/lib/core/pipes/localized-date.pipe.spec.ts b/lib/core/pipes/localized-date.pipe.spec.ts index ede84b5ae94..6db24e1c625 100644 --- a/lib/core/pipes/localized-date.pipe.spec.ts +++ b/lib/core/pipes/localized-date.pipe.spec.ts @@ -16,7 +16,7 @@ */ import { LocalizedDatePipe } from './localized-date.pipe'; -import { async, TestBed } from '@angular/core/testing'; +import { TestBed } from '@angular/core/testing'; import { AppConfigService } from '../app-config/app-config.service'; import { UserPreferencesService } from '../services/user-preferences.service'; import { of } from 'rxjs'; @@ -39,11 +39,11 @@ describe('LocalizedDatePipe', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { userPreferences = TestBed.inject(UserPreferencesService); spyOn(userPreferences, 'select').and.returnValue(of('')); pipe = new LocalizedDatePipe(userPreferences, TestBed.inject(AppConfigService)); - })); + }); it('should return time with locale en-US', () => { const date = new Date('1990-11-03 00:00'); diff --git a/lib/core/services/auth-guard-sso-role.service.spec.ts b/lib/core/services/auth-guard-sso-role.service.spec.ts index 12a810903d4..49d48d35dc0 100644 --- a/lib/core/services/auth-guard-sso-role.service.spec.ts +++ b/lib/core/services/auth-guard-sso-role.service.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, TestBed } from '@angular/core/testing'; +import { TestBed } from '@angular/core/testing'; import { ActivatedRouteSnapshot, Router } from '@angular/router'; import { setupTestBed } from '../testing/setup-test-bed'; import { CoreTestingModule } from '../testing/core.testing.module'; @@ -49,7 +49,7 @@ describe('Auth Guard SSO role service', () => { peopleContentService = TestBed.inject(PeopleContentService); }); - it('Should canActivate be true if the Role is present int the JWT token', async(async () => { + it('Should canActivate be true if the Role is present int the JWT token', async () => { spyOn(jwtHelperService, 'getAccessToken').and.returnValue('my-access_token'); spyOn(jwtHelperService, 'decodeToken').and.returnValue({ 'realm_access': { roles: ['role1'] } }); @@ -57,9 +57,9 @@ describe('Auth Guard SSO role service', () => { router.data = { 'roles': ['role1', 'role2'] }; expect(await authGuard.canActivate(router)).toBeTruthy(); - })); + }); - it('Should canActivate be false if the Role is not present int the JWT token', async(async () => { + it('Should canActivate be false if the Role is not present int the JWT token', async () => { spyOn(jwtHelperService, 'getAccessToken').and.returnValue('my-access_token'); spyOn(jwtHelperService, 'decodeToken').and.returnValue({ 'realm_access': { roles: ['role3'] } }); @@ -67,9 +67,9 @@ describe('Auth Guard SSO role service', () => { router.data = { 'roles': ['role1', 'role2'] }; expect(await authGuard.canActivate(router)).toBeFalsy(); - })); + }); - it('Should not redirect if canActivate is', async(async () => { + it('Should not redirect if canActivate is', async () => { spyOn(jwtHelperService, 'getAccessToken').and.returnValue('my-access_token'); spyOn(jwtHelperService, 'decodeToken').and.returnValue({ 'realm_access': { roles: ['role1'] } }); spyOn(routerService, 'navigate').and.stub(); @@ -79,27 +79,27 @@ describe('Auth Guard SSO role service', () => { expect(await authGuard.canActivate(router)).toBeTruthy(); expect(routerService.navigate).not.toHaveBeenCalled(); - })); + }); - it('Should canActivate return false if the data Role to check is empty', async(async () => { + it('Should canActivate return false if the data Role to check is empty', async () => { spyOn(jwtHelperService, 'getAccessToken').and.returnValue('my-access_token'); spyOn(jwtHelperService, 'decodeToken').and.returnValue({ 'realm_access': { roles: ['role1', 'role3'] } }); const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); expect(await authGuard.canActivate(router)).toBeFalsy(); - })); + }); - it('Should canActivate return false if the realm_access is not present', async(async () => { + it('Should canActivate return false if the realm_access is not present', async () => { spyOn(jwtHelperService, 'getAccessToken').and.returnValue('my-access_token'); spyOn(jwtHelperService, 'decodeToken').and.returnValue({}); const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); expect(await authGuard.canActivate(router)).toBeFalsy(); - })); + }); - it('Should redirect to the redirectURL if canActivate is false and redirectUrl is in data', async(async () => { + it('Should redirect to the redirectURL if canActivate is false and redirectUrl is in data', async () => { spyOn(jwtHelperService, 'getAccessToken').and.returnValue('my-access_token'); spyOn(jwtHelperService, 'decodeToken').and.returnValue({}); spyOn(routerService, 'navigate').and.stub(); @@ -109,9 +109,9 @@ describe('Auth Guard SSO role service', () => { expect(await authGuard.canActivate(router)).toBeFalsy(); expect(routerService.navigate).toHaveBeenCalledWith(['/no-role-url']); - })); + }); - it('Should not redirect if canActivate is false and redirectUrl is not in data', async(async () => { + it('Should not redirect if canActivate is false and redirectUrl is not in data', async () => { spyOn(jwtHelperService, 'getAccessToken').and.returnValue('my-access_token'); spyOn(jwtHelperService, 'decodeToken').and.returnValue({}); spyOn(routerService, 'navigate').and.stub(); @@ -121,7 +121,7 @@ describe('Auth Guard SSO role service', () => { expect(await authGuard.canActivate(router)).toBeFalsy(); expect(routerService.navigate).not.toHaveBeenCalled(); - })); + }); it('Should canActivate be false hasRealm is true and hasClientRole is false', async () => { const route: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); diff --git a/lib/core/services/auth-guard.service.spec.ts b/lib/core/services/auth-guard.service.spec.ts index 874a70fa3a4..c72f0d80740 100644 --- a/lib/core/services/auth-guard.service.spec.ts +++ b/lib/core/services/auth-guard.service.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, TestBed } from '@angular/core/testing'; +import { TestBed } from '@angular/core/testing'; import { Router, RouterStateSnapshot } from '@angular/router'; import { AppConfigService } from '../app-config/app-config.service'; import { AuthGuard } from './auth-guard.service'; @@ -53,33 +53,33 @@ describe('AuthGuardService', () => { storageService = TestBed.inject(StorageService); }); - it('if the alfresco js api is logged in should canActivate be true', async(async () => { + it('if the alfresco js api is logged in should canActivate be true', async () => { spyOn(router, 'navigateByUrl'); spyOn(authService, 'isLoggedIn').and.returnValue(true); expect(await authGuard.canActivate(null, state)).toBeTruthy(); expect(router.navigateByUrl).not.toHaveBeenCalled(); - })); + }); - it('if the alfresco js api is NOT logged in should canActivate be false', async(async () => { + it('if the alfresco js api is NOT logged in should canActivate be false', async () => { state.url = 'some-url'; spyOn(router, 'navigateByUrl'); spyOn(authService, 'isLoggedIn').and.returnValue(false); expect(await authGuard.canActivate(null, state)).toBeFalsy(); expect(router.navigateByUrl).toHaveBeenCalled(); - })); + }); - it('if the alfresco js api is configured with withCredentials true should canActivate be true', async(async () => { + it('if the alfresco js api is configured with withCredentials true should canActivate be true', async () => { spyOn(authService, 'isBpmLoggedIn').and.returnValue(true); appConfigService.config.auth.withCredentials = true; const route: RouterStateSnapshot = { url: 'some-url' }; expect(await authGuard.canActivate(null, route)).toBeTruthy(); - })); + }); - it('should not redirect to login', async(async () => { + it('should not redirect to login', async () => { storageService.setItem('loginFragment', 'login'); spyOn(router, 'navigateByUrl').and.stub(); @@ -89,9 +89,9 @@ describe('AuthGuardService', () => { expect(await authGuard.canActivate(null, state)).toBeTruthy(); expect(router.navigateByUrl).not.toHaveBeenCalled(); - })); + }); - it('should redirect url if the User is NOT logged in and isOAuthWithoutSilentLogin', async(async () => { + it('should redirect url if the User is NOT logged in and isOAuthWithoutSilentLogin', async () => { spyOn(router, 'navigateByUrl').and.stub(); spyOn(authService, 'isLoggedIn').and.returnValue(false); spyOn(authService, 'isOauth').and.returnValue(true); @@ -99,9 +99,9 @@ describe('AuthGuardService', () => { expect(await authGuard.canActivate(null, state)).toBeFalsy(); expect(router.navigateByUrl).toHaveBeenCalled(); - })); + }); - it('should redirect url if the User is NOT logged in and isOAuth but no silentLogin configured', async(async () => { + it('should redirect url if the User is NOT logged in and isOAuth but no silentLogin configured', async () => { spyOn(router, 'navigateByUrl').and.stub(); spyOn(authService, 'isLoggedIn').and.returnValue(false); spyOn(authService, 'isOauth').and.returnValue(true); @@ -109,9 +109,9 @@ describe('AuthGuardService', () => { expect(await authGuard.canActivate(null, state)).toBeFalsy(); expect(router.navigateByUrl).toHaveBeenCalled(); - })); + }); - it('should NOT redirect url if the User is NOT logged in and isOAuth but with silentLogin configured', async(async () => { + it('should NOT redirect url if the User is NOT logged in and isOAuth but with silentLogin configured', async () => { spyOn(authService, 'ssoImplicitLogin').and.stub(); spyOn(authService, 'isLoggedIn').and.returnValue(false); spyOn(authService, 'isOauth').and.returnValue(true); @@ -119,9 +119,9 @@ describe('AuthGuardService', () => { expect(await authGuard.canActivate(null, state)).toBeFalsy(); expect(authService.ssoImplicitLogin).toHaveBeenCalledTimes(1); - })); + }); - it('should set redirect url', async(async () => { + it('should set redirect url', async () => { state.url = 'some-url'; appConfigService.config.loginRoute = 'login'; @@ -134,9 +134,9 @@ describe('AuthGuardService', () => { provider: 'ALL', url: 'some-url' }); expect(router.navigateByUrl).toHaveBeenCalledWith(router.parseUrl('/login?redirectUrl=some-url')); - })); + }); - it('should set redirect url with query params', async(async () => { + it('should set redirect url with query params', async () => { state.url = 'some-url;q=query'; appConfigService.config.loginRoute = 'login'; appConfigService.config.provider = 'ALL'; @@ -150,9 +150,9 @@ describe('AuthGuardService', () => { provider: 'ALL', url: 'some-url;q=query' }); expect(router.navigateByUrl).toHaveBeenCalledWith(router.parseUrl('/login?redirectUrl=some-url;q=query')); - })); + }); - it('should get redirect url from config if there is one configured', async(async () => { + it('should get redirect url from config if there is one configured', async () => { state.url = 'some-url'; appConfigService.config.loginRoute = 'fakeLoginRoute'; @@ -165,9 +165,9 @@ describe('AuthGuardService', () => { provider: 'ALL', url: 'some-url' }); expect(router.navigateByUrl).toHaveBeenCalledWith(router.parseUrl('/fakeLoginRoute?redirectUrl=some-url')); - })); + }); - it('should pass actual redirect when no state segments exists', async(async () => { + it('should pass actual redirect when no state segments exists', async () => { state.url = '/'; spyOn(router, 'navigateByUrl'); @@ -178,5 +178,5 @@ describe('AuthGuardService', () => { expect(authService.setRedirect).toHaveBeenCalledWith({ provider: 'ALL', url: '/' }); - })); + }); }); diff --git a/lib/core/services/identity-group.service.spec.ts b/lib/core/services/identity-group.service.spec.ts index 33bc019e44a..82837e0788b 100644 --- a/lib/core/services/identity-group.service.spec.ts +++ b/lib/core/services/identity-group.service.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, TestBed } from '@angular/core/testing'; +import { fakeAsync, TestBed } from '@angular/core/testing'; import { setupTestBed, AlfrescoApiService, IdentityGroupService, IdentityGroupSearchParam } from '@alfresco/adf-core'; import { HttpErrorResponse } from '@angular/common/http'; import { throwError, of } from 'rxjs'; @@ -46,7 +46,7 @@ describe('IdentityGroupService', () => { ] }); - beforeEach(async(() => { + beforeEach(fakeAsync(() => { service = TestBed.inject(IdentityGroupService); apiService = TestBed.inject(AlfrescoApiService); })); diff --git a/lib/core/userinfo/components/user-info.component.spec.ts b/lib/core/userinfo/components/user-info.component.spec.ts index f59676631cd..83ed2f60bdb 100644 --- a/lib/core/userinfo/components/user-info.component.spec.ts +++ b/lib/core/userinfo/components/user-info.component.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By, DomSanitizer } from '@angular/platform-browser'; import { AuthenticationService, ContentService } from '../../services'; import { InitialUsernamePipe } from '../../pipes'; @@ -94,7 +94,7 @@ describe('User info component', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { fixture = TestBed.createComponent(UserInfoComponent); component = fixture.componentInstance; element = fixture.nativeElement; @@ -108,7 +108,7 @@ describe('User info component', () => { spyOn(window, 'requestAnimationFrame').and.returnValue(1); spyOn(bpmUserService, 'getCurrentUserProfileImage').and.returnValue('app/rest/admin/profile-picture'); spyOn(contentService, 'getContentUrl').and.returnValue('alfresco-logo.svg'); - })); + }); afterEach(() => { fixture.destroy(); @@ -209,13 +209,13 @@ describe('User info component', () => { describe('and has image', () => { - beforeEach(async(() => { + beforeEach(() => { isOauthStub.and.returnValue(false); isEcmLoggedInStub.and.returnValue(true); isLoggedInStub.and.returnValue(true); getCurrenEcmtUserInfoStub.and.returnValue(of(fakeEcmUser)); fixture.detectChanges(); - })); + }); it('should get the ecm current user image from the service', async () => { await fixture.whenStable(); @@ -316,15 +316,15 @@ describe('User info component', () => { describe('when user is logged on bpm', () => { - let getCurrentUserInfoStub; + let getCurrentUserInfoStub: jasmine.Spy; - beforeEach(async(() => { + beforeEach(() => { isOauthStub.and.returnValue(false); isBpmLoggedInStub.and.returnValue(true); isLoggedInStub.and.returnValue(true); isEcmLoggedInStub.and.returnValue(false); getCurrentUserInfoStub = spyOn(bpmUserService, 'getCurrentUserInfo').and.returnValue(of(fakeBpmUser)); - })); + }); it('should fetch bpm userInfo', (done) => { getCurrentUserInfoStub.and.returnValue(of(fakeBpmUser)); @@ -427,7 +427,7 @@ describe('User info component', () => { describe('when user is logged on bpm and ecm', () => { - beforeEach(async(() => { + beforeEach(() => { isOauthStub.and.returnValue(false); isEcmLoggedInStub.and.returnValue(true); isBpmLoggedInStub.and.returnValue(true); @@ -435,7 +435,7 @@ describe('User info component', () => { getCurrenEcmtUserInfoStub.and.returnValue(of(fakeEcmUser)); spyOn(bpmUserService, 'getCurrentUserInfo').and.returnValue(of(fakeBpmUser)); - })); + }); it('should able to fetch ecm userInfo', (done) => { fixture.detectChanges(); @@ -537,14 +537,14 @@ describe('User info component', () => { describe('when identity user is logged in', () => { - let getCurrentUserInfoStub; + let getCurrentUserInfoStub: jasmine.Spy; - beforeEach(async(() => { + beforeEach(() => { isOauthStub.and.returnValue(true); isLoggedInStub.and.returnValue(true); isEcmLoggedInStub.and.returnValue(false); getCurrentUserInfoStub = spyOn(identityUserService, 'getCurrentUserInfo').and.returnValue(identityUserMock); - })); + }); it('should show the identity user initials if is not ecm user', async () => { fixture.detectChanges(); diff --git a/lib/core/viewer/components/pdf-viewer-thumb.component.spec.ts b/lib/core/viewer/components/pdf-viewer-thumb.component.spec.ts index 8fdfc52284f..e81bdf34138 100644 --- a/lib/core/viewer/components/pdf-viewer-thumb.component.spec.ts +++ b/lib/core/viewer/components/pdf-viewer-thumb.component.spec.ts @@ -16,7 +16,7 @@ */ import { DomSanitizer } from '@angular/platform-browser'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { PdfThumbComponent } from './pdf-viewer-thumb.component'; import { setupTestBed } from '../../testing/setup-test-bed'; import { CoreTestingModule } from '../../testing/core.testing.module'; @@ -52,10 +52,10 @@ describe('PdfThumbComponent', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { fixture = TestBed.createComponent(PdfThumbComponent); component = fixture.componentInstance; - })); + }); it('should have resolve image data', (done) => { component.page = page; diff --git a/lib/core/viewer/components/pdf-viewer-thumbnails.component.spec.ts b/lib/core/viewer/components/pdf-viewer-thumbnails.component.spec.ts index ddcb869fa1a..9139feed7f1 100644 --- a/lib/core/viewer/components/pdf-viewer-thumbnails.component.spec.ts +++ b/lib/core/viewer/components/pdf-viewer-thumbnails.component.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { PdfThumbListComponent } from './pdf-viewer-thumbnails.component'; import { setupTestBed } from '../../testing/setup-test-bed'; @@ -69,7 +69,7 @@ describe('PdfThumbListComponent', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { fixture = TestBed.createComponent(PdfThumbListComponent); component = fixture.componentInstance; component.pdfViewer = viewerMock; @@ -80,7 +80,7 @@ describe('PdfThumbListComponent', () => { fixture.nativeElement.style.overflow = 'scroll'; fixture.debugElement.query(By.css('.adf-pdf-thumbnails__content')) .nativeElement.style.height = '2000px'; - })); + }); it('should render initial rage of items', () => { fixture.nativeElement.scrollTop = 0; diff --git a/lib/core/viewer/components/txt-viewer.component.ts b/lib/core/viewer/components/txt-viewer.component.ts index 8477b575290..43e360cf208 100644 --- a/lib/core/viewer/components/txt-viewer.component.ts +++ b/lib/core/viewer/components/txt-viewer.component.ts @@ -38,7 +38,7 @@ export class TxtViewerComponent implements OnChanges { constructor(private http: HttpClient, private appConfigService: AppConfigService) { } - ngOnChanges(changes: SimpleChanges): Promise { + ngOnChanges(changes: SimpleChanges): Promise { const blobFile = changes['blobFile']; if (blobFile && blobFile.currentValue) { @@ -57,7 +57,7 @@ export class TxtViewerComponent implements OnChanges { return Promise.resolve(); } - private getUrlContent(url: string): Promise { + private getUrlContent(url: string): Promise { const withCredentialsMode = this.appConfigService.get('auth.withCredentials', false); return new Promise((resolve, reject) => { @@ -70,7 +70,7 @@ export class TxtViewerComponent implements OnChanges { }); } - private readBlob(blob: Blob): Promise { + private readBlob(blob: Blob): Promise { return new Promise((resolve, reject) => { const reader = new FileReader(); diff --git a/lib/core/viewer/directives/viewer-extension.directive.spec.ts b/lib/core/viewer/directives/viewer-extension.directive.spec.ts index 97b13e556c5..ee900e88beb 100644 --- a/lib/core/viewer/directives/viewer-extension.directive.spec.ts +++ b/lib/core/viewer/directives/viewer-extension.directive.spec.ts @@ -18,7 +18,7 @@ import { Location } from '@angular/common'; import { SpyLocation } from '@angular/common/testing'; import { ElementRef } from '@angular/core'; -import { async, TestBed } from '@angular/core/testing'; +import { TestBed } from '@angular/core/testing'; import { ViewerComponent } from '../components/viewer.component'; import { ViewerExtensionDirective } from './viewer-extension.directive'; import { setupTestBed } from '../../testing/setup-test-bed'; @@ -47,10 +47,10 @@ describe('ExtensionViewerDirective', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { extensionViewerDirective = TestBed.inject(ViewerExtensionDirective); extensionViewerDirective.templateModel = {template: '', isVisible: false}; - })); + }); it('is defined', () => { expect(extensionViewerDirective).toBeDefined(); diff --git a/lib/extensions/src/lib/components/dynamic-component/dynamic.component.spec.ts b/lib/extensions/src/lib/components/dynamic-component/dynamic.component.spec.ts index 85e6ad1e525..e1770a22b71 100644 --- a/lib/extensions/src/lib/components/dynamic-component/dynamic.component.spec.ts +++ b/lib/extensions/src/lib/components/dynamic-component/dynamic.component.spec.ts @@ -24,7 +24,7 @@ import { SimpleChange, ComponentFactoryResolver } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { DynamicExtensionComponent } from './dynamic.component'; import { ComponentRegisterService } from '../../services/component-register.service'; @@ -50,7 +50,7 @@ describe('DynamicExtensionComponent', () => { let component: DynamicExtensionComponent; let componentFactoryResolver: ComponentFactoryResolver; - beforeEach(async(() => { + beforeEach(() => { componentRegister = new ComponentRegisterService(); componentRegister.setComponents({ 'test-component': TestComponent }); @@ -61,7 +61,7 @@ describe('DynamicExtensionComponent', () => { }); TestBed.compileComponents(); - })); + }); describe('Sub-component creation', () => { diff --git a/lib/process-services-cloud/src/lib/form/components/form-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/form/components/form-cloud.component.spec.ts index b06d9298d6b..8ba8ae4327d 100644 --- a/lib/process-services-cloud/src/lib/form/components/form-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/form-cloud.component.spec.ts @@ -17,7 +17,7 @@ import { Component, DebugElement, SimpleChange, NgModule, Injector, ComponentFactoryResolver, ViewChild } from '@angular/core'; import { By } from '@angular/platform-browser'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Observable, of, throwError } from 'rxjs'; import { CoreModule, @@ -118,7 +118,7 @@ describe('FormCloudComponent', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { const apiService = TestBed.inject(AlfrescoApiService); spyOn(apiService, 'getInstance').and.returnValue(mockOauth2Auth); @@ -133,7 +133,7 @@ describe('FormCloudComponent', () => { fixture = TestBed.createComponent(FormCloudComponent); formComponent = fixture.componentInstance; fixture.detectChanges(); - })); + }); it('should register custom [upload] widget', () => { const widget = buildWidget('upload', fixture.componentRef.injector); @@ -1154,7 +1154,7 @@ describe('retrieve metadata on submit', () => { } }; - beforeEach(async(() => { + beforeEach(() => { const apiService = TestBed.inject(AlfrescoApiService); spyOn(apiService, 'getInstance').and.returnValue(mockOauth2Auth); @@ -1164,7 +1164,7 @@ describe('retrieve metadata on submit', () => { formComponent = fixture.componentInstance; formComponent.form = formComponent.parseForm(fakeMetadataForm); fixture.detectChanges(); - })); + }); it('should set values when updateFormValuesRequested is updated', async () => { formComponent.form.values['pfx_property_three'] = {}; diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.spec.ts index 2d7fa19d74e..fb6db61eb30 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.spec.ts @@ -405,7 +405,7 @@ describe('AttachFileCloudWidgetComponent', () => { expect(widget.rootNodeId).toEqual('-my-'); }); - it('should return the application name in case -appname- placeholder is present', async() => { + it('should return the application name in case -appname- placeholder is present', () => { appConfigService.config = Object.assign(appConfigService.config, { 'alfresco-deployed-apps': [ { @@ -417,7 +417,7 @@ describe('AttachFileCloudWidgetComponent', () => { expect(widget.replaceAppNameAliasWithValue('/myfiles/-appname-/folder')).toBe('/myfiles/fakeapp/folder'); }); - it('should return the same value in case -appname- placeholder is NOT present', async() => { + it('should return the same value in case -appname- placeholder is NOT present', () => { expect(widget.replaceAppNameAliasWithValue('/myfiles/fakepath/folder')).toBe('/myfiles/fakepath/folder'); }); diff --git a/lib/process-services-cloud/src/lib/pipes/process-name-cloud.pipe.spec.ts b/lib/process-services-cloud/src/lib/pipes/process-name-cloud.pipe.spec.ts index 10c32fe0810..81c3e3c3a0b 100644 --- a/lib/process-services-cloud/src/lib/pipes/process-name-cloud.pipe.spec.ts +++ b/lib/process-services-cloud/src/lib/pipes/process-name-cloud.pipe.spec.ts @@ -30,7 +30,7 @@ describe('ProcessNameCloudPipe', () => { const defaultName = 'default-name'; const datetimeIdentifier = '%{datetime}'; const processDefinitionIdentifier = '%{processDefinition}'; - const mockCurrentDate = new Date('Wed Oct 23 2019'); + const mockCurrentDate: number = new Date('Wed Oct 23 2019').getTime(); const mockLocalizedCurrentDate = 'Oct 23, 2019, 12:00:00 AM'; const nameWithProcessDefinitionIdentifier = `${defaultName} - ${processDefinitionIdentifier}`; const nameWithDatetimeIdentifier = `${defaultName} - ${datetimeIdentifier}`; diff --git a/lib/process-services-cloud/src/lib/process/process-filters/services/process-filter-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/process/process-filters/services/process-filter-cloud.service.spec.ts index 134257d2c16..ba3a58a1229 100644 --- a/lib/process-services-cloud/src/lib/process/process-filters/services/process-filter-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/process/process-filters/services/process-filter-cloud.service.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, TestBed } from '@angular/core/testing'; +import { TestBed } from '@angular/core/testing'; import { setupTestBed, IdentityUserService } from '@alfresco/adf-core'; import { of } from 'rxjs'; import { ProcessFilterCloudService } from './process-filter-cloud.service'; @@ -50,7 +50,7 @@ describe('ProcessFilterCloudService', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { service = TestBed.inject(ProcessFilterCloudService); const preferenceCloudService = service.preferenceService; @@ -61,7 +61,7 @@ describe('ProcessFilterCloudService', () => { getPreferenceByKeySpy = spyOn(preferenceCloudService, 'getPreferenceByKey').and.returnValue(of(fakeProcessCloudFilters)); getPreferencesSpy = spyOn(preferenceCloudService, 'getPreferences').and.returnValue(of(fakeProcessCloudFilterEntries)); getCurrentUserInfoSpy = spyOn(identityUserService, 'getCurrentUserInfo').and.returnValue(identityUserMock); - })); + }); it('should create processfilter key by using appName and the username', (done) => { service.getProcessFilters('mock-appName').subscribe((res: any) => { diff --git a/lib/process-services-cloud/src/lib/process/process-list/services/process-list-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/process/process-list/services/process-list-cloud.service.spec.ts index dc1135d1747..78c3c9f13cf 100644 --- a/lib/process-services-cloud/src/lib/process/process-list/services/process-list-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/process/process-list/services/process-list-cloud.service.spec.ts @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { async, TestBed } from '@angular/core/testing'; +import { fakeAsync, TestBed } from '@angular/core/testing'; import { setupTestBed, AlfrescoApiService } from '@alfresco/adf-core'; import { ProcessListCloudService } from './process-list-cloud.service'; import { ProcessQueryCloudRequestModel } from '../models/process-cloud-query-request.model'; @@ -56,13 +56,13 @@ describe('ProcessListCloudService', () => { ] }); - beforeEach(async(() => { + beforeEach(fakeAsync(() => { alfrescoApiService = TestBed.inject(AlfrescoApiService); service = TestBed.inject(ProcessListCloudService); })); it('should append to the call all the parameters', (done) => { - const processRequest: ProcessQueryCloudRequestModel = { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' }; + const processRequest = { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' } as ProcessQueryCloudRequestModel; spyOn(alfrescoApiService, 'getInstance').and.callFake(returnCallQueryParameters); service.getProcessByRequest(processRequest).subscribe((res) => { expect(res).toBeDefined(); @@ -75,7 +75,7 @@ describe('ProcessListCloudService', () => { }); it('should concat the app name to the request url', (done) => { - const processRequest: ProcessQueryCloudRequestModel = { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' }; + const processRequest = { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' } as ProcessQueryCloudRequestModel; spyOn(alfrescoApiService, 'getInstance').and.callFake(returnCallUrl); service.getProcessByRequest(processRequest).subscribe((requestUrl) => { expect(requestUrl).toBeDefined(); @@ -86,10 +86,10 @@ describe('ProcessListCloudService', () => { }); it('should concat the sorting to append as parameters', (done) => { - const processRequest: ProcessQueryCloudRequestModel = { + const processRequest = { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service', sorting: [{ orderBy: 'NAME', direction: 'DESC' }, { orderBy: 'TITLE', direction: 'ASC' }] - }; + } as ProcessQueryCloudRequestModel; spyOn(alfrescoApiService, 'getInstance').and.callFake(returnCallQueryParameters); service.getProcessByRequest(processRequest).subscribe((res) => { expect(res).toBeDefined(); @@ -100,7 +100,7 @@ describe('ProcessListCloudService', () => { }); it('should return an error when app name is not specified', (done) => { - const processRequest: ProcessQueryCloudRequestModel = { appName: null }; + const processRequest = { appName: null } as ProcessQueryCloudRequestModel; spyOn(alfrescoApiService, 'getInstance').and.callFake(returnCallUrl); service.getProcessByRequest(processRequest).subscribe( () => { }, diff --git a/lib/process-services-cloud/src/lib/services/notification-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/services/notification-cloud.service.spec.ts index cd3d3fe4afb..59e0af96e29 100644 --- a/lib/process-services-cloud/src/lib/services/notification-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/services/notification-cloud.service.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { TestBed, async } from '@angular/core/testing'; +import { TestBed } from '@angular/core/testing'; import { AlfrescoApiService, setupTestBed } from '@alfresco/adf-core'; import { ProcessServiceCloudTestingModule } from '../testing/process-service-cloud.testing.module'; import { TranslateModule } from '@ngx-translate/core'; @@ -60,7 +60,7 @@ describe('NotificationCloudService', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { service = TestBed.inject(NotificationCloudService); apollo = TestBed.inject(Apollo); apiService = TestBed.inject(AlfrescoApiService); @@ -69,7 +69,7 @@ describe('NotificationCloudService', () => { service.appsListening = []; apolloCreateSpy = spyOn(apollo, 'createNamed'); apolloSubscribeSpy = spyOn(apollo, 'use').and.returnValue(useMock); - })); + }); it('should not create more than one websocket per app if it was already created', () => { service.makeGQLQuery('myAppName', queryMock); diff --git a/lib/process-services-cloud/src/lib/services/user-preference-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/services/user-preference-cloud.service.spec.ts index fd4a295ccdd..fe147ceee92 100644 --- a/lib/process-services-cloud/src/lib/services/user-preference-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/services/user-preference-cloud.service.spec.ts @@ -15,8 +15,7 @@ * limitations under the License. */ -import { TestBed, async } from '@angular/core/testing'; - +import { TestBed } from '@angular/core/testing'; import { UserPreferenceCloudService } from './user-preference-cloud.service'; import { setupTestBed, AlfrescoApiService } from '@alfresco/adf-core'; import { mockPreferences, getMockPreference, createMockPreference, updateMockPreference } from '../mock/user-preference.mock'; @@ -63,11 +62,11 @@ describe('PreferenceService', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { service = TestBed.inject(UserPreferenceCloudService); alfrescoApiMock = TestBed.inject(AlfrescoApiService); getInstanceSpy = spyOn(alfrescoApiMock, 'getInstance').and.returnValue(apiMock(mockPreferences)); - })); + }); it('should return the preferences', (done) => { service.getPreferences('mock-app-name').subscribe((res: any) => { diff --git a/lib/process-services-cloud/src/lib/task/task-list/services/service-task-list-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/task/task-list/services/service-task-list-cloud.service.spec.ts index 2c5934213f1..89f563ded1e 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/services/service-task-list-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/services/service-task-list-cloud.service.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, TestBed } from '@angular/core/testing'; +import { TestBed } from '@angular/core/testing'; import { setupTestBed, AlfrescoApiService } from '@alfresco/adf-core'; import { ServiceTaskListCloudService } from './service-task-list-cloud.service'; import { ServiceTaskQueryCloudRequestModel } from '../models/service-task-cloud.model'; @@ -59,10 +59,10 @@ describe('Activiti ServiceTaskList Cloud Service', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { alfrescoApiService = TestBed.inject(AlfrescoApiService); service = TestBed.inject(ServiceTaskListCloudService); - })); + }); it('should append to the call all the parameters', (done) => { const taskRequest: ServiceTaskQueryCloudRequestModel = { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' }; diff --git a/lib/process-services/src/lib/content-widget/attach-file-widget-dialog.component.spec.ts b/lib/process-services/src/lib/content-widget/attach-file-widget-dialog.component.spec.ts index ee18e86ddb9..514fa1492e3 100644 --- a/lib/process-services/src/lib/content-widget/attach-file-widget-dialog.component.spec.ts +++ b/lib/process-services/src/lib/content-widget/attach-file-widget-dialog.component.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { ContentModule, ContentNodeSelectorPanelComponent, DocumentListService } from '@alfresco/adf-content-services'; import { EventEmitter, NO_ERRORS_SCHEMA } from '@angular/core'; @@ -63,7 +63,7 @@ describe('AttachFileWidgetDialogComponent', () => { schemas: [NO_ERRORS_SCHEMA] }); - beforeEach(async(() => { + beforeEach(() => { fixture = TestBed.createComponent(AttachFileWidgetDialogComponent); widget = fixture.componentInstance; element = fixture.nativeElement; @@ -83,7 +83,7 @@ describe('AttachFileWidgetDialogComponent', () => { spyOn(widget, 'isLoggedIn').and.callFake(() => { return isLogged; }); - })); + }); afterEach(() => { fixture.destroy(); @@ -96,10 +96,10 @@ describe('AttachFileWidgetDialogComponent', () => { describe('When is not logged in', () => { - beforeEach(async(() => { + beforeEach(() => { fixture.detectChanges(); isLogged = false; - })); + }); it('should show the login form', () => { expect(element.querySelector('#attach-file-login-panel')).not.toBeNull(); @@ -135,11 +135,11 @@ describe('AttachFileWidgetDialogComponent', () => { let contentNodePanel; - beforeEach(async(() => { + beforeEach(() => { isLogged = true; fixture.detectChanges(); contentNodePanel = fixture.debugElement.query(By.directive(ContentNodeSelectorPanelComponent)); - })); + }); it('should show the content node selector', () => { expect(element.querySelector('#attach-file-content-node')).not.toBeNull(); @@ -175,21 +175,21 @@ describe('AttachFileWidgetDialogComponent', () => { }); describe('login only', () => { - beforeEach(async(() => { + beforeEach(() => { spyOn(authService, 'login').and.returnValue(of({ type: 'type', ticket: 'ticket'})); spyOn(matDialogRef, 'close').and.callThrough(); fixture.detectChanges(); widget.data.loginOnly = true; widget.data.registerExternalHost = () => {}; isLogged = false; - })); + }); it('should close the dialog once user loggedIn', () => { fixture.detectChanges(); isLogged = true; - const loginButton: HTMLButtonElement = element.querySelector('button[data-automation-id="attach-file-dialog-actions-login"]'); - const usernameInput: HTMLInputElement = element.querySelector('#username'); - const passwordInput: HTMLInputElement = element.querySelector('#password'); + const loginButton = element.querySelector('button[data-automation-id="attach-file-dialog-actions-login"]'); + const usernameInput = element.querySelector('#username'); + const passwordInput = element.querySelector('#password'); usernameInput.value = 'fake-user'; passwordInput.value = 'fake-user'; usernameInput.dispatchEvent(new Event('input')); @@ -211,9 +211,9 @@ describe('AttachFileWidgetDialogComponent', () => { describe('Attach button', () => { - beforeEach(async(() => { + beforeEach(() => { isLogged = true; - })); + }); it('should be disabled by default', () => { fixture.detectChanges(); diff --git a/lib/process-services/src/lib/people/components/people-list/people-list.component.spec.ts b/lib/process-services/src/lib/people/components/people-list/people-list.component.spec.ts index c708a6f0f47..d5eca2e6fdb 100644 --- a/lib/process-services/src/lib/people/components/people-list/people-list.component.spec.ts +++ b/lib/process-services/src/lib/people/components/people-list/people-list.component.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UserProcessModel, setupTestBed, DataRowActionEvent, DataRowEvent, ObjectDataRow } from '@alfresco/adf-core'; import { UserEventModel } from '../../../task-list/models/user-event.model'; import { PeopleListComponent } from './people-list.component'; @@ -41,11 +41,11 @@ describe('PeopleListComponent', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { fixture = TestBed.createComponent(PeopleListComponent); peopleListComponent = fixture.componentInstance; fixture.detectChanges(); - })); + }); it('should emit row click event', (done) => { const row = new ObjectDataRow(fakeUser); diff --git a/lib/process-services/src/lib/people/components/people-search/people-search.component.spec.ts b/lib/process-services/src/lib/people/components/people-search/people-search.component.spec.ts index 4582084ac18..ab28617df18 100644 --- a/lib/process-services/src/lib/people/components/people-search/people-search.component.spec.ts +++ b/lib/process-services/src/lib/people/components/people-search/people-search.component.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UserProcessModel, setupTestBed } from '@alfresco/adf-core'; import { of } from 'rxjs'; import { PeopleSearchComponent } from './people-search.component'; @@ -51,13 +51,13 @@ describe('PeopleSearchComponent', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { fixture = TestBed.createComponent(PeopleSearchComponent); peopleSearchComponent = fixture.componentInstance; element = fixture.nativeElement; peopleSearchComponent.results = of([]); fixture.detectChanges(); - })); + }); it('should show input search text', () => { expect(element.querySelector('#userSearchText')).toBeDefined(); diff --git a/lib/process-services/src/lib/pipes/process-name.pipe.spec.ts b/lib/process-services/src/lib/pipes/process-name.pipe.spec.ts index 433e57633d3..5df6821efbb 100644 --- a/lib/process-services/src/lib/pipes/process-name.pipe.spec.ts +++ b/lib/process-services/src/lib/pipes/process-name.pipe.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, TestBed } from '@angular/core/testing'; +import { TestBed } from '@angular/core/testing'; import { ProcessNamePipe } from './process-name.pipe'; import { setupTestBed } from 'core'; import { CoreTestingModule } from 'core/testing/core.testing.module'; @@ -30,7 +30,7 @@ describe('ProcessNamePipe', () => { const defaultName = 'default-name'; const datetimeIdentifier = '%{datetime}'; const processDefinitionIdentifier = '%{processDefinition}'; - const mockCurrentDate = new Date('Wed Oct 23 2019'); + const mockCurrentDate: number = new Date('Wed Oct 23 2019').getTime(); const mockLocalizedCurrentDate = 'Oct 23, 2019, 12:00:00 AM'; const nameWithProcessDefinitionIdentifier = `${defaultName} - ${processDefinitionIdentifier}`; const nameWithDatetimeIdentifier = `${defaultName} - ${datetimeIdentifier}`; @@ -44,10 +44,10 @@ describe('ProcessNamePipe', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { const localizedDatePipe = TestBed.inject(LocalizedDatePipe); processNamePipe = new ProcessNamePipe(localizedDatePipe); - })); + }); it('should not modify the name when there is no identifier', () => { const transformResult = processNamePipe.transform(defaultName); diff --git a/lib/process-services/src/lib/task-list/components/start-task.component.spec.ts b/lib/process-services/src/lib/task-list/components/start-task.component.spec.ts index 215fd0fcb3a..1b76cbf04e2 100644 --- a/lib/process-services/src/lib/task-list/components/start-task.component.spec.ts +++ b/lib/process-services/src/lib/task-list/components/start-task.component.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { setupTestBed, LogService } from '@alfresco/adf-core'; import { of, throwError } from 'rxjs'; import { TaskListService } from '../services/tasklist.service'; @@ -56,7 +56,7 @@ describe('StartTaskComponent', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { fixture = TestBed.createComponent(StartTaskComponent); component = fixture.componentInstance; element = fixture.nativeElement; @@ -67,7 +67,7 @@ describe('StartTaskComponent', () => { getFormListSpy = spyOn(service, 'getFormList').and.returnValue(of(fakeForms$)); fixture.detectChanges(); - })); + }); afterEach(() => { fixture.destroy(); diff --git a/lib/process-services/src/lib/task-list/components/task-audit.directive.spec.ts b/lib/process-services/src/lib/task-list/components/task-audit.directive.spec.ts index ba0e30074ae..0ee57fd5e0a 100644 --- a/lib/process-services/src/lib/task-list/components/task-audit.directive.spec.ts +++ b/lib/process-services/src/lib/task-list/components/task-audit.directive.spec.ts @@ -16,12 +16,7 @@ */ import { Component } from '@angular/core'; -import { - async, - ComponentFixture, - fakeAsync, - TestBed -} from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing'; import { of } from 'rxjs'; import { TaskListService } from './../services/tasklist.service'; import { setupTestBed } from '@alfresco/adf-core'; @@ -83,13 +78,13 @@ describe('TaskAuditDirective', () => { declarations: [BasicButtonComponent] }); - beforeEach(async(() => { + beforeEach(() => { fixture = TestBed.createComponent(BasicButtonComponent); component = fixture.componentInstance; service = TestBed.inject(TaskListService); jasmine.Ajax.install(); - })); + }); afterEach(() => { jasmine.Ajax.uninstall(); diff --git a/lib/process-services/src/lib/task-list/services/task-filter.service.spec.ts b/lib/process-services/src/lib/task-list/services/task-filter.service.spec.ts index 163aeab8761..009c4743015 100644 --- a/lib/process-services/src/lib/task-list/services/task-filter.service.spec.ts +++ b/lib/process-services/src/lib/task-list/services/task-filter.service.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, TestBed } from '@angular/core/testing'; +import { TestBed } from '@angular/core/testing'; import { fakeAppPromise } from '../../mock'; import { fakeFiltersResponse, fakeAppFilter } from '../../mock/task/task-filters.mock'; import { FilterRepresentationModel } from '../models/filter.model'; @@ -36,10 +36,10 @@ describe('Activiti Task filter Service', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { service = TestBed.inject(TaskFilterService); jasmine.Ajax.install(); - })); + }); afterEach(() => { jasmine.Ajax.uninstall(); diff --git a/lib/process-services/src/lib/task-list/services/tasklist.service.spec.ts b/lib/process-services/src/lib/task-list/services/tasklist.service.spec.ts index 0d625e4da46..70ac6615a31 100644 --- a/lib/process-services/src/lib/task-list/services/tasklist.service.spec.ts +++ b/lib/process-services/src/lib/task-list/services/tasklist.service.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { async, TestBed } from '@angular/core/testing'; +import { TestBed } from '@angular/core/testing'; import { UserProcessModel, setupTestBed, CoreModule } from '@alfresco/adf-core'; import { of } from 'rxjs'; import { @@ -49,10 +49,10 @@ describe('Activiti TaskList Service', () => { ] }); - beforeEach(async(() => { + beforeEach(() => { service = TestBed.inject(TaskListService); jasmine.Ajax.install(); - })); + }); afterEach(() => { jasmine.Ajax.uninstall();