diff --git a/src/app/+admin/admin-access-control/epeople-registry/epeople-registry.component.spec.ts b/src/app/+admin/admin-access-control/epeople-registry/epeople-registry.component.spec.ts index cd45796615..c104de0b17 100644 --- a/src/app/+admin/admin-access-control/epeople-registry/epeople-registry.component.spec.ts +++ b/src/app/+admin/admin-access-control/epeople-registry/epeople-registry.component.spec.ts @@ -1,14 +1,13 @@ import { Router } from '@angular/router'; -import { of as observableOf } from 'rxjs'; +import { Observable, of as observableOf } from 'rxjs'; import { CommonModule } from '@angular/common'; import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BrowserModule, By } from '@angular/platform-browser'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core'; -import { Observable } from 'rxjs'; -import { PaginatedList, buildPaginatedList } from '../../../core/data/paginated-list.model'; +import { buildPaginatedList, PaginatedList } from '../../../core/data/paginated-list.model'; import { RemoteData } from '../../../core/data/remote-data'; import { FindListOptions } from '../../../core/data/request.models'; import { EPersonDataService } from '../../../core/eperson/eperson-data.service'; @@ -38,13 +37,18 @@ describe('EPeopleRegistryComponent', () => { let authorizationService: AuthorizationDataService; let modalService; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { mockEPeople = [EPersonMock, EPersonMock2]; ePersonDataServiceStub = { activeEPerson: null, allEpeople: mockEPeople, getEPeople(): Observable>> { - return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ elementsPerPage: this.allEpeople.length, totalElements: this.allEpeople.length, totalPages: 1, currentPage: 1 }), this.allEpeople)); + return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ + elementsPerPage: this.allEpeople.length, + totalElements: this.allEpeople.length, + totalPages: 1, + currentPage: 1 + }), this.allEpeople)); }, getActiveEPerson(): Observable { return observableOf(this.activeEPerson); @@ -54,18 +58,38 @@ describe('EPeopleRegistryComponent', () => { const result = this.allEpeople.find((ePerson: EPerson) => { return ePerson.email === query; }); - return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ elementsPerPage: [result].length, totalElements: [result].length, totalPages: 1, currentPage: 1 }), [result])); + return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ + elementsPerPage: [result].length, + totalElements: [result].length, + totalPages: 1, + currentPage: 1 + }), [result])); } if (scope === 'metadata') { if (query === '') { - return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ elementsPerPage: this.allEpeople.length, totalElements: this.allEpeople.length, totalPages: 1, currentPage: 1 }), this.allEpeople)); + return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ + elementsPerPage: this.allEpeople.length, + totalElements: this.allEpeople.length, + totalPages: 1, + currentPage: 1 + }), this.allEpeople)); } const result = this.allEpeople.find((ePerson: EPerson) => { return (ePerson.name.includes(query) || ePerson.email.includes(query)); }); - return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ elementsPerPage: [result].length, totalElements: [result].length, totalPages: 1, currentPage: 1 }), [result])); + return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ + elementsPerPage: [result].length, + totalElements: [result].length, + totalPages: 1, + currentPage: 1 + }), [result])); } - return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ elementsPerPage: this.allEpeople.length, totalElements: this.allEpeople.length, totalPages: 1, currentPage: 1 }), this.allEpeople)); + return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ + elementsPerPage: this.allEpeople.length, + totalElements: this.allEpeople.length, + totalPages: 1, + currentPage: 1 + }), this.allEpeople)); }, deleteEPerson(ePerson: EPerson): Observable { this.allEpeople = this.allEpeople.filter((ePerson2: EPerson) => { @@ -107,7 +131,7 @@ describe('EPeopleRegistryComponent', () => { { provide: AuthorizationDataService, useValue: authorizationService }, { provide: FormBuilderService, useValue: builderService }, { provide: Router, useValue: new RouterStub() }, - { provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring'])} + { provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) } ], schemas: [NO_ERRORS_SCHEMA] }).compileComponents(); @@ -234,7 +258,7 @@ describe('EPeopleRegistryComponent', () => { }); }); - it ('should be disabled', () => { + it('should be disabled', () => { ePeopleDeleteButton = fixture.debugElement.queryAll(By.css('#epeople tr td div button.delete-button')); ePeopleDeleteButton.forEach((deleteButton) => { expect(deleteButton.nativeElement.disabled).toBe(true); diff --git a/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts b/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts index 81d2afe920..1163490e12 100644 --- a/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts +++ b/src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts @@ -6,7 +6,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BrowserModule, By } from '@angular/platform-browser'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; -import { PaginatedList, buildPaginatedList } from '../../../../core/data/paginated-list.model'; +import { buildPaginatedList, PaginatedList } from '../../../../core/data/paginated-list.model'; import { RemoteData } from '../../../../core/data/remote-data'; import { FindListOptions } from '../../../../core/data/request.models'; import { EPersonDataService } from '../../../../core/eperson/eperson-data.service'; @@ -121,7 +121,7 @@ describe('EPersonFormComponent', () => { { provide: NotificationsService, useValue: new NotificationsServiceStub() }, { provide: AuthService, useValue: authService }, { provide: AuthorizationDataService, useValue: authorizationService }, - { provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring'])} + { provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) } ], schemas: [NO_ERRORS_SCHEMA] }).compileComponents(); @@ -281,19 +281,19 @@ describe('EPersonFormComponent', () => { }); - it ('the delete button should be active if the eperson can be deleted', () => { + it('the delete button should be active if the eperson can be deleted', () => { const deleteButton = fixture.debugElement.query(By.css('.delete-button')); expect(deleteButton.nativeElement.disabled).toBe(false); }); - it ('the delete button should be disabled if the eperson cannot be deleted', () => { + it('the delete button should be disabled if the eperson cannot be deleted', () => { component.canDelete$ = observableOf(false); fixture.detectChanges(); const deleteButton = fixture.debugElement.query(By.css('.delete-button')); expect(deleteButton.nativeElement.disabled).toBe(true); }); - it ('should call the epersonFormComponent delete when clicked on the button' , () => { + it('should call the epersonFormComponent delete when clicked on the button', () => { spyOn(component, 'delete').and.stub(); spyOn(component.epersonService, 'deleteEPerson').and.returnValue(createSuccessfulRemoteDataObject$('No Content', 204)); const deleteButton = fixture.debugElement.query(By.css('.delete-button')); @@ -301,7 +301,7 @@ describe('EPersonFormComponent', () => { expect(component.delete).toHaveBeenCalled(); }); - it ('should call the epersonService delete when clicked on the button' , () => { + it('should call the epersonService delete when clicked on the button', () => { // ePersonDataServiceStub.activeEPerson = eperson; spyOn(component.epersonService, 'deleteEPerson').and.returnValue(createSuccessfulRemoteDataObject$('No Content', 204)); const deleteButton = fixture.debugElement.query(By.css('.delete-button')); diff --git a/src/app/+admin/admin-access-control/group-registry/group-form/group-form.component.spec.ts b/src/app/+admin/admin-access-control/group-registry/group-form/group-form.component.spec.ts index 2bcbc78ede..fd5edf0354 100644 --- a/src/app/+admin/admin-access-control/group-registry/group-form/group-form.component.spec.ts +++ b/src/app/+admin/admin-access-control/group-registry/group-form/group-form.component.spec.ts @@ -14,7 +14,7 @@ import { ObjectCacheService } from '../../../../core/cache/object-cache.service' import { DSOChangeAnalyzer } from '../../../../core/data/dso-change-analyzer.service'; import { DSpaceObjectDataService } from '../../../../core/data/dspace-object-data.service'; import { AuthorizationDataService } from '../../../../core/data/feature-authorization/authorization-data.service'; -import { PaginatedList, buildPaginatedList } from '../../../../core/data/paginated-list.model'; +import { buildPaginatedList, PaginatedList } from '../../../../core/data/paginated-list.model'; import { RemoteData } from '../../../../core/data/remote-data'; import { EPersonDataService } from '../../../../core/eperson/eperson-data.service'; import { GroupDataService } from '../../../../core/eperson/group-data.service'; @@ -144,7 +144,10 @@ describe('GroupFormComponent', () => { { provide: Store, useValue: {} }, { provide: RemoteDataBuildService, useValue: {} }, { provide: HALEndpointService, useValue: {} }, - { provide: ActivatedRoute, useValue: { data: observableOf({ dso: { payload: {} } }), params: observableOf({}) } }, + { + provide: ActivatedRoute, + useValue: { data: observableOf({ dso: { payload: {} } }), params: observableOf({}) } + }, { provide: Router, useValue: router }, { provide: AuthorizationDataService, useValue: authorizationService }, ], diff --git a/src/app/+admin/admin-access-control/group-registry/group-form/members-list/members-list.component.spec.ts b/src/app/+admin/admin-access-control/group-registry/group-form/members-list/members-list.component.spec.ts index 7fa8eb72ed..10735cbde5 100644 --- a/src/app/+admin/admin-access-control/group-registry/group-form/members-list/members-list.component.spec.ts +++ b/src/app/+admin/admin-access-control/group-registry/group-form/members-list/members-list.component.spec.ts @@ -1,14 +1,6 @@ import { CommonModule } from '@angular/common'; import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { - async, - ComponentFixture, - fakeAsync, - flush, - inject, - TestBed, - tick -} from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, flush, inject, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BrowserModule, By } from '@angular/platform-browser'; import { Router } from '@angular/router'; @@ -16,7 +8,7 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core'; import { Observable, of as observableOf } from 'rxjs'; import { RestResponse } from '../../../../../core/cache/response.models'; -import { PaginatedList, buildPaginatedList } from '../../../../../core/data/paginated-list.model'; +import { buildPaginatedList, PaginatedList } from '../../../../../core/data/paginated-list.model'; import { RemoteData } from '../../../../../core/data/remote-data'; import { EPersonDataService } from '../../../../../core/eperson/eperson-data.service'; import { GroupDataService } from '../../../../../core/eperson/group-data.service'; @@ -48,7 +40,7 @@ describe('MembersListComponent', () => { let epersonMembers; let subgroupMembers; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { activeGroup = GroupMock; epersonMembers = [EPersonMock2]; subgroupMembers = [GroupMock2]; diff --git a/src/app/+admin/admin-access-control/group-registry/group-form/subgroup-list/subgroups-list.component.spec.ts b/src/app/+admin/admin-access-control/group-registry/group-form/subgroup-list/subgroups-list.component.spec.ts index ede13d81e9..2122a96cf3 100644 --- a/src/app/+admin/admin-access-control/group-registry/group-form/subgroup-list/subgroups-list.component.spec.ts +++ b/src/app/+admin/admin-access-control/group-registry/group-form/subgroup-list/subgroups-list.component.spec.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, fakeAsync, flush, inject, TestBed, tick } from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, flush, inject, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BrowserModule, By } from '@angular/platform-browser'; import { Router } from '@angular/router'; @@ -8,7 +8,7 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core'; import { Observable, of as observableOf } from 'rxjs'; import { RestResponse } from '../../../../../core/cache/response.models'; -import { PaginatedList, buildPaginatedList } from '../../../../../core/data/paginated-list.model'; +import { buildPaginatedList, PaginatedList } from '../../../../../core/data/paginated-list.model'; import { RemoteData } from '../../../../../core/data/remote-data'; import { GroupDataService } from '../../../../../core/eperson/group-data.service'; import { Group } from '../../../../../core/eperson/models/group.model'; @@ -36,7 +36,7 @@ describe('SubgroupsListComponent', () => { let allGroups; let routerStub; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { activeGroup = GroupMock; subgroups = [GroupMock2]; allGroups = [GroupMock, GroupMock2]; diff --git a/src/app/+admin/admin-access-control/group-registry/groups-registry.component.spec.ts b/src/app/+admin/admin-access-control/group-registry/groups-registry.component.spec.ts index a3985ba44f..dd08ea6772 100644 --- a/src/app/+admin/admin-access-control/group-registry/groups-registry.component.spec.ts +++ b/src/app/+admin/admin-access-control/group-registry/groups-registry.component.spec.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, fakeAsync, inject, TestBed, tick } from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, inject, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BrowserModule, By } from '@angular/platform-browser'; import { Router } from '@angular/router'; @@ -9,7 +9,7 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { Observable, of as observableOf } from 'rxjs'; import { DSpaceObjectDataService } from '../../../core/data/dspace-object-data.service'; import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service'; -import { PaginatedList, buildPaginatedList } from '../../../core/data/paginated-list.model'; +import { buildPaginatedList, PaginatedList } from '../../../core/data/paginated-list.model'; import { RemoteData } from '../../../core/data/remote-data'; import { RequestService } from '../../../core/data/request.service'; import { EPersonDataService } from '../../../core/eperson/eperson-data.service'; @@ -40,18 +40,33 @@ describe('GroupRegistryComponent', () => { let mockGroups; let mockEPeople; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { mockGroups = [GroupMock, GroupMock2]; mockEPeople = [EPersonMock, EPersonMock2]; ePersonDataServiceStub = { findAllByHref(href: string): Observable>> { switch (href) { case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid2/epersons': - return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ elementsPerPage: 1, totalElements: 0, totalPages: 0, currentPage: 1 }), [])); + return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ + elementsPerPage: 1, + totalElements: 0, + totalPages: 0, + currentPage: 1 + }), [])); case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid/epersons': - return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ elementsPerPage: 1, totalElements: 1, totalPages: 1, currentPage: 1 }), [EPersonMock])); + return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ + elementsPerPage: 1, + totalElements: 1, + totalPages: 1, + currentPage: 1 + }), [EPersonMock])); default: - return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ elementsPerPage: 1, totalElements: 0, totalPages: 0, currentPage: 1 }), [])); + return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ + elementsPerPage: 1, + totalElements: 0, + totalPages: 0, + currentPage: 1 + }), [])); } } }; @@ -60,11 +75,26 @@ describe('GroupRegistryComponent', () => { findAllByHref(href: string): Observable>> { switch (href) { case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid2/groups': - return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ elementsPerPage: 1, totalElements: 0, totalPages: 0, currentPage: 1 }), [])); + return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ + elementsPerPage: 1, + totalElements: 0, + totalPages: 0, + currentPage: 1 + }), [])); case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid/groups': - return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ elementsPerPage: 1, totalElements: 1, totalPages: 1, currentPage: 1 }), [GroupMock2])); + return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ + elementsPerPage: 1, + totalElements: 1, + totalPages: 1, + currentPage: 1 + }), [GroupMock2])); default: - return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ elementsPerPage: 1, totalElements: 0, totalPages: 0, currentPage: 1 }), [])); + return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ + elementsPerPage: 1, + totalElements: 0, + totalPages: 0, + currentPage: 1 + }), [])); } }, getGroupEditPageRouterLink(group: Group): string { @@ -75,12 +105,22 @@ describe('GroupRegistryComponent', () => { }, searchGroups(query: string): Observable>> { if (query === '') { - return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ elementsPerPage: this.allGroups.length, totalElements: this.allGroups.length, totalPages: 1, currentPage: 1 }), this.allGroups)); + return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ + elementsPerPage: this.allGroups.length, + totalElements: this.allGroups.length, + totalPages: 1, + currentPage: 1 + }), this.allGroups)); } const result = this.allGroups.find((group: Group) => { return (group.id.includes(query)); }); - return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ elementsPerPage: [result].length, totalElements: [result].length, totalPages: 1, currentPage: 1 }), [result])); + return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ + elementsPerPage: [result].length, + totalElements: [result].length, + totalPages: 1, + currentPage: 1 + }), [result])); } }; dsoDataServiceStub = { @@ -109,7 +149,7 @@ describe('GroupRegistryComponent', () => { { provide: RouteService, useValue: routeServiceStub }, { provide: Router, useValue: new RouterMock() }, { provide: AuthorizationDataService, useValue: authorizationService }, - { provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring'])} + { provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) } ], schemas: [NO_ERRORS_SCHEMA] }).compileComponents(); diff --git a/src/app/+admin/admin-curation-tasks/admin-curation-tasks.component.spec.ts b/src/app/+admin/admin-curation-tasks/admin-curation-tasks.component.spec.ts index b84f619ff1..358bd0d01e 100644 --- a/src/app/+admin/admin-curation-tasks/admin-curation-tasks.component.spec.ts +++ b/src/app/+admin/admin-curation-tasks/admin-curation-tasks.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { AdminCurationTasksComponent } from './admin-curation-tasks.component'; import { TranslateModule } from '@ngx-translate/core'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; @@ -7,7 +7,7 @@ describe('AdminCurationTasksComponent', () => { let comp: AdminCurationTasksComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], declarations: [AdminCurationTasksComponent], diff --git a/src/app/+admin/admin-import-metadata-page/metadata-import-page.component.spec.ts b/src/app/+admin/admin-import-metadata-page/metadata-import-page.component.spec.ts index b551515f54..db6bb7db84 100644 --- a/src/app/+admin/admin-import-metadata-page/metadata-import-page.component.spec.ts +++ b/src/app/+admin/admin-import-metadata-page/metadata-import-page.component.spec.ts @@ -1,6 +1,6 @@ import { Location } from '@angular/common'; import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, TestBed, waitForAsync } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; import { Router } from '@angular/router'; @@ -52,7 +52,7 @@ describe('MetadataImportPageComponent', () => { }); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ diff --git a/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.spec.ts b/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.spec.ts index a8b510cca6..6787350d86 100644 --- a/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.spec.ts +++ b/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.spec.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { Router } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; @@ -45,9 +45,9 @@ describe('AddBitstreamFormatComponent', () => { imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], declarations: [AddBitstreamFormatComponent], providers: [ - {provide: Router, useValue: router}, - {provide: NotificationsService, useValue: notificationService}, - {provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService}, + { provide: Router, useValue: router }, + { provide: NotificationsService, useValue: notificationService }, + { provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService }, ], schemas: [CUSTOM_ELEMENTS_SCHEMA] }).compileComponents(); @@ -61,7 +61,7 @@ describe('AddBitstreamFormatComponent', () => { }; describe('createBitstreamFormat success', () => { - beforeEach(async(initAsync)); + beforeEach(waitForAsync(initAsync)); beforeEach(initBeforeEach); it('should send the updated form to the service, show a notification and navigate to ', () => { comp.createBitstreamFormat(bitstreamFormat); @@ -73,7 +73,7 @@ describe('AddBitstreamFormatComponent', () => { }); }); describe('createBitstreamFormat error', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { router = new RouterStub(); notificationService = new NotificationsServiceStub(); bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', { @@ -85,9 +85,9 @@ describe('AddBitstreamFormatComponent', () => { imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], declarations: [AddBitstreamFormatComponent], providers: [ - {provide: Router, useValue: router}, - {provide: NotificationsService, useValue: notificationService}, - {provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService}, + { provide: Router, useValue: router }, + { provide: NotificationsService, useValue: notificationService }, + { provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService }, ], schemas: [CUSTOM_ELEMENTS_SCHEMA] }).compileComponents(); diff --git a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.spec.ts b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.spec.ts index 0e426a20e3..74ca566029 100644 --- a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.spec.ts +++ b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.spec.ts @@ -1,5 +1,5 @@ import { BitstreamFormatsComponent } from './bitstream-formats.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { of as observableOf } from 'rxjs'; import { CommonModule } from '@angular/common'; import { RouterTestingModule } from '@angular/router/testing'; @@ -87,7 +87,7 @@ describe('BitstreamFormatsComponent', () => { bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', { findAll: observableOf(mockFormatsRD), find: createSuccessfulRemoteDataObject$(mockFormatsList[0]), - getSelectedBitstreamFormats: hot('a', {a: mockFormatsList}), + getSelectedBitstreamFormats: hot('a', { a: mockFormatsList }), selectBitstreamFormat: {}, deselectBitstreamFormat: {}, deselectAllBitstreamFormats: {}, @@ -99,9 +99,9 @@ describe('BitstreamFormatsComponent', () => { imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe], providers: [ - {provide: BitstreamFormatDataService, useValue: bitstreamFormatService}, - {provide: HostWindowService, useValue: new HostWindowServiceStub(0)}, - {provide: NotificationsService, useValue: notificationsServiceStub} + { provide: BitstreamFormatDataService, useValue: bitstreamFormatService }, + { provide: HostWindowService, useValue: new HostWindowServiceStub(0) }, + { provide: NotificationsService, useValue: notificationsServiceStub } ] }).compileComponents(); }; @@ -113,7 +113,7 @@ describe('BitstreamFormatsComponent', () => { }; describe('Bitstream format page content', () => { - beforeEach(async(initAsync)); + beforeEach(waitForAsync(initAsync)); beforeEach(initBeforeEach); it('should contain four formats', () => { @@ -137,17 +137,17 @@ describe('BitstreamFormatsComponent', () => { }); describe('selectBitStreamFormat', () => { - beforeEach(async(initAsync)); + beforeEach(waitForAsync(initAsync)); beforeEach(initBeforeEach); it('should select a bitstreamFormat if it was selected in the event', () => { - const event = {target: {checked: true}}; + const event = { target: { checked: true } }; comp.selectBitStreamFormat(bitstreamFormat1, event); expect(bitstreamFormatService.selectBitstreamFormat).toHaveBeenCalledWith(bitstreamFormat1); }); it('should deselect a bitstreamFormat if it is deselected in the event', () => { - const event = {target: {checked: false}}; + const event = { target: { checked: false } }; comp.selectBitStreamFormat(bitstreamFormat1, event); @@ -157,7 +157,7 @@ describe('BitstreamFormatsComponent', () => { spyOn(comp, 'selectBitStreamFormat'); const unknownFormat = fixture.debugElement.query(By.css('#formats tr:nth-child(1) input')); - const event = {target: {checked: true}}; + const event = { target: { checked: true } }; unknownFormat.triggerEventHandler('change', event); expect(comp.selectBitStreamFormat).toHaveBeenCalledWith(bitstreamFormat1, event); @@ -165,12 +165,12 @@ describe('BitstreamFormatsComponent', () => { }); describe('isSelected', () => { - beforeEach(async(initAsync)); + beforeEach(waitForAsync(initAsync)); beforeEach(initBeforeEach); it('should return an observable of true if the provided bistream is in the list returned by the service', () => { const result = comp.isSelected(bitstreamFormat1); - expect(result).toBeObservable(cold('b', {b: true})); + expect(result).toBeObservable(cold('b', { b: true })); }); it('should return an observable of false if the provided bistream is not in the list returned by the service', () => { const format = new BitstreamFormat(); @@ -178,12 +178,12 @@ describe('BitstreamFormatsComponent', () => { const result = comp.isSelected(format); - expect(result).toBeObservable(cold('b', {b: false})); + expect(result).toBeObservable(cold('b', { b: false })); }); }); describe('deselectAll', () => { - beforeEach(async(initAsync)); + beforeEach(waitForAsync(initAsync)); beforeEach(initBeforeEach); it('should deselect all bitstreamFormats', () => { comp.deselectAll(); @@ -201,7 +201,7 @@ describe('BitstreamFormatsComponent', () => { }); describe('deleteFormats success', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { notificationsServiceStub = new NotificationsServiceStub(); scheduler = getTestScheduler(); @@ -221,9 +221,9 @@ describe('BitstreamFormatsComponent', () => { imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe], providers: [ - {provide: BitstreamFormatDataService, useValue: bitstreamFormatService}, - {provide: HostWindowService, useValue: new HostWindowServiceStub(0)}, - {provide: NotificationsService, useValue: notificationsServiceStub} + { provide: BitstreamFormatDataService, useValue: bitstreamFormatService }, + { provide: HostWindowService, useValue: new HostWindowServiceStub(0) }, + { provide: NotificationsService, useValue: notificationsServiceStub } ] }).compileComponents(); } @@ -247,7 +247,7 @@ describe('BitstreamFormatsComponent', () => { }); describe('deleteFormats error', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { notificationsServiceStub = new NotificationsServiceStub(); scheduler = getTestScheduler(); @@ -267,9 +267,9 @@ describe('BitstreamFormatsComponent', () => { imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe], providers: [ - {provide: BitstreamFormatDataService, useValue: bitstreamFormatService}, - {provide: HostWindowService, useValue: new HostWindowServiceStub(0)}, - {provide: NotificationsService, useValue: notificationsServiceStub} + { provide: BitstreamFormatDataService, useValue: bitstreamFormatService }, + { provide: HostWindowService, useValue: new HostWindowServiceStub(0) }, + { provide: NotificationsService, useValue: notificationsServiceStub } ] }).compileComponents(); } diff --git a/src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.spec.ts b/src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.spec.ts index a8bd41d569..b09c50c70a 100644 --- a/src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.spec.ts +++ b/src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.spec.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; @@ -45,7 +45,7 @@ describe('EditBitstreamFormatComponent', () => { let bitstreamFormatDataService: BitstreamFormatDataService; const initAsync = () => { - router = new RouterStub(); + router = new RouterStub(); notificationService = new NotificationsServiceStub(); bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', { updateBitstreamFormat: createSuccessfulRemoteDataObject$({}) @@ -55,10 +55,10 @@ describe('EditBitstreamFormatComponent', () => { imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], declarations: [EditBitstreamFormatComponent], providers: [ - {provide: ActivatedRoute, useValue: routeStub}, - {provide: Router, useValue: router}, - {provide: NotificationsService, useValue: notificationService}, - {provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService}, + { provide: ActivatedRoute, useValue: routeStub }, + { provide: Router, useValue: router }, + { provide: NotificationsService, useValue: notificationService }, + { provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService }, ], schemas: [CUSTOM_ELEMENTS_SCHEMA] }).compileComponents(); @@ -72,7 +72,7 @@ describe('EditBitstreamFormatComponent', () => { }; describe('init', () => { - beforeEach(async(initAsync)); + beforeEach(waitForAsync(initAsync)); beforeEach(initBeforeEach); it('should initialise the bitstreamFormat based on the route', () => { @@ -83,7 +83,7 @@ describe('EditBitstreamFormatComponent', () => { }); }); describe('updateFormat success', () => { - beforeEach(async(initAsync)); + beforeEach(waitForAsync(initAsync)); beforeEach(initBeforeEach); it('should send the updated form to the service, show a notification and navigate to ', () => { comp.updateFormat(bitstreamFormat); @@ -95,8 +95,8 @@ describe('EditBitstreamFormatComponent', () => { }); }); describe('updateFormat error', () => { - beforeEach(async( () => { - router = new RouterStub(); + beforeEach(waitForAsync(() => { + router = new RouterStub(); notificationService = new NotificationsServiceStub(); bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', { updateBitstreamFormat: createFailedRemoteDataObject$('Error', 500) @@ -106,10 +106,10 @@ describe('EditBitstreamFormatComponent', () => { imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], declarations: [EditBitstreamFormatComponent], providers: [ - {provide: ActivatedRoute, useValue: routeStub}, - {provide: Router, useValue: router}, - {provide: NotificationsService, useValue: notificationService}, - {provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService}, + { provide: ActivatedRoute, useValue: routeStub }, + { provide: Router, useValue: router }, + { provide: NotificationsService, useValue: notificationService }, + { provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService }, ], schemas: [CUSTOM_ELEMENTS_SCHEMA] }).compileComponents(); diff --git a/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.spec.ts b/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.spec.ts index fc1b4d50a0..ca3fbcbc99 100644 --- a/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.spec.ts +++ b/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { CommonModule } from '@angular/common'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; @@ -43,7 +43,7 @@ describe('FormatFormComponent', () => { imports: [CommonModule, RouterTestingModule.withRoutes([]), ReactiveFormsModule, FormsModule, TranslateModule.forRoot(), NgbModule], declarations: [FormatFormComponent], providers: [ - {provide: Router, useValue: router}, + { provide: Router, useValue: router }, ], schemas: [CUSTOM_ELEMENTS_SCHEMA] }).compileComponents(); @@ -58,7 +58,7 @@ describe('FormatFormComponent', () => { }; describe('initialise', () => { - beforeEach(async(initAsync)); + beforeEach(waitForAsync(initAsync)); beforeEach(initBeforeEach); it('should initialises the values in the form', () => { @@ -82,7 +82,7 @@ describe('FormatFormComponent', () => { }); }); describe('onSubmit', () => { - beforeEach(async(initAsync)); + beforeEach(waitForAsync(initAsync)); beforeEach(initBeforeEach); it('should emit the bitstreamFormat currently present in the form', () => { @@ -93,7 +93,7 @@ describe('FormatFormComponent', () => { }); }); describe('onCancel', () => { - beforeEach(async(initAsync)); + beforeEach(waitForAsync(initAsync)); beforeEach(initBeforeEach); it('should navigate back to the bitstream overview', () => { diff --git a/src/app/+admin/admin-registries/metadata-registry/metadata-registry.component.spec.ts b/src/app/+admin/admin-registries/metadata-registry/metadata-registry.component.spec.ts index b0d48d5a10..a5a65198af 100644 --- a/src/app/+admin/admin-registries/metadata-registry/metadata-registry.component.spec.ts +++ b/src/app/+admin/admin-registries/metadata-registry/metadata-registry.component.spec.ts @@ -1,5 +1,5 @@ import { MetadataRegistryComponent } from './metadata-registry.component'; -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { of as observableOf } from 'rxjs'; import { buildPaginatedList } from '../../../core/data/paginated-list.model'; import { TranslateModule } from '@ngx-translate/core'; @@ -51,15 +51,18 @@ describe('MetadataRegistryComponent', () => { getMetadataSchemas: () => mockSchemas, getActiveMetadataSchema: () => observableOf(undefined), getSelectedMetadataSchemas: () => observableOf([]), - editMetadataSchema: (schema) => {}, - cancelEditMetadataSchema: () => {}, + editMetadataSchema: (schema) => { + }, + cancelEditMetadataSchema: () => { + }, deleteMetadataSchema: () => observableOf(new RestResponse(true, 200, 'OK')), - deselectAllMetadataSchema: () => {}, + deselectAllMetadataSchema: () => { + }, clearMetadataSchemaRequests: () => observableOf(undefined) }; /* tslint:enable:no-empty */ - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], declarations: [MetadataRegistryComponent, PaginationComponent, EnumKeysPipe], @@ -107,13 +110,13 @@ describe('MetadataRegistryComponent', () => { fixture.detectChanges(); }); - it('should start editing the selected schema', async(() => { + it('should start editing the selected schema', waitForAsync(() => { fixture.whenStable().then(() => { expect(registryService.editMetadataSchema).toHaveBeenCalledWith(mockSchemasList[0] as MetadataSchema); }); })); - it('should cancel editing the selected schema when clicked again', async(() => { + it('should cancel editing the selected schema when clicked again', waitForAsync(() => { spyOn(registryService, 'getActiveMetadataSchema').and.returnValue(observableOf(mockSchemasList[0] as MetadataSchema)); spyOn(registryService, 'cancelEditMetadataSchema'); row.click(); @@ -134,7 +137,7 @@ describe('MetadataRegistryComponent', () => { fixture.detectChanges(); }); - it('should call deleteMetadataSchema with the selected id', async(() => { + it('should call deleteMetadataSchema with the selected id', waitForAsync(() => { fixture.whenStable().then(() => { expect(registryService.deleteMetadataSchema).toHaveBeenCalledWith(selectedSchemas[0].id); }); diff --git a/src/app/+admin/admin-registries/metadata-registry/metadata-registry.reducers.spec.ts b/src/app/+admin/admin-registries/metadata-registry/metadata-registry.reducers.spec.ts index 48d1b89e7c..3e26a8fdc1 100644 --- a/src/app/+admin/admin-registries/metadata-registry/metadata-registry.reducers.spec.ts +++ b/src/app/+admin/admin-registries/metadata-registry/metadata-registry.reducers.spec.ts @@ -1,9 +1,13 @@ import { MetadataRegistryCancelFieldAction, - MetadataRegistryCancelSchemaAction, MetadataRegistryDeselectAllFieldAction, - MetadataRegistryDeselectAllSchemaAction, MetadataRegistryDeselectFieldAction, - MetadataRegistryDeselectSchemaAction, MetadataRegistryEditFieldAction, - MetadataRegistryEditSchemaAction, MetadataRegistrySelectFieldAction, + MetadataRegistryCancelSchemaAction, + MetadataRegistryDeselectAllFieldAction, + MetadataRegistryDeselectAllSchemaAction, + MetadataRegistryDeselectFieldAction, + MetadataRegistryDeselectSchemaAction, + MetadataRegistryEditFieldAction, + MetadataRegistryEditSchemaAction, + MetadataRegistrySelectFieldAction, MetadataRegistrySelectSchemaAction } from './metadata-registry.actions'; import { metadataRegistryReducer, MetadataRegistryState } from './metadata-registry.reducers'; @@ -12,6 +16,7 @@ import { MetadataField } from '../../../core/metadata/metadata-field.model'; class NullAction extends MetadataRegistryEditSchemaAction { type = null; + constructor() { super(undefined); } diff --git a/src/app/+admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.spec.ts b/src/app/+admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.spec.ts index 18647afad0..f486c3c132 100644 --- a/src/app/+admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.spec.ts +++ b/src/app/+admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { MetadataSchemaFormComponent } from './metadata-schema-form.component'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -21,22 +21,24 @@ describe('MetadataSchemaFormComponent', () => { const registryServiceStub = { getActiveMetadataSchema: () => observableOf(undefined), createOrUpdateMetadataSchema: (schema: MetadataSchema) => observableOf(schema), - cancelEditMetadataSchema: () => {}, + cancelEditMetadataSchema: () => { + }, clearMetadataSchemaRequests: () => observableOf(undefined) }; const formBuilderServiceStub = { createFormGroup: () => { return { - patchValue: () => {} + patchValue: () => { + } }; } }; /* tslint:enable:no-empty */ - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], - declarations: [ MetadataSchemaFormComponent, EnumKeysPipe ], + declarations: [MetadataSchemaFormComponent, EnumKeysPipe], providers: [ { provide: RegistryService, useValue: registryServiceStub }, { provide: FormBuilderService, useValue: formBuilderServiceStub } @@ -77,7 +79,7 @@ describe('MetadataSchemaFormComponent', () => { fixture.detectChanges(); }); - it('should emit a new schema using the correct values', async(() => { + it('should emit a new schema using the correct values', waitForAsync(() => { fixture.whenStable().then(() => { expect(component.submitForm.emit).toHaveBeenCalledWith(expected); }); @@ -97,7 +99,7 @@ describe('MetadataSchemaFormComponent', () => { fixture.detectChanges(); }); - it('should edit the existing schema using the correct values', async(() => { + it('should edit the existing schema using the correct values', waitForAsync(() => { fixture.whenStable().then(() => { expect(component.submitForm.emit).toHaveBeenCalledWith(expectedWithId); }); diff --git a/src/app/+admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.spec.ts b/src/app/+admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.spec.ts index 9a7fc59ba8..1bd25be113 100644 --- a/src/app/+admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.spec.ts +++ b/src/app/+admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { MetadataFieldFormComponent } from './metadata-field-form.component'; import { RegistryService } from '../../../../core/registry/registry.service'; @@ -29,23 +29,26 @@ describe('MetadataFieldFormComponent', () => { getActiveMetadataField: () => observableOf(undefined), createMetadataField: (field: MetadataField) => observableOf(field), updateMetadataField: (field: MetadataField) => observableOf(field), - cancelEditMetadataField: () => {}, - cancelEditMetadataSchema: () => {}, + cancelEditMetadataField: () => { + }, + cancelEditMetadataSchema: () => { + }, clearMetadataFieldRequests: () => observableOf(undefined) }; const formBuilderServiceStub = { createFormGroup: () => { return { - patchValue: () => {} + patchValue: () => { + } }; } }; /* tslint:enable:no-empty */ - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], - declarations: [ MetadataFieldFormComponent, EnumKeysPipe ], + declarations: [MetadataFieldFormComponent, EnumKeysPipe], providers: [ { provide: RegistryService, useValue: registryServiceStub }, { provide: FormBuilderService, useValue: formBuilderServiceStub } @@ -95,7 +98,7 @@ describe('MetadataFieldFormComponent', () => { fixture.detectChanges(); }); - it('should emit a new field using the correct values', async(() => { + it('should emit a new field using the correct values', waitForAsync(() => { fixture.whenStable().then(() => { expect(component.submitForm.emit).toHaveBeenCalledWith(expected); }); @@ -117,7 +120,7 @@ describe('MetadataFieldFormComponent', () => { fixture.detectChanges(); }); - it('should edit the existing field using the correct values', async(() => { + it('should edit the existing field using the correct values', waitForAsync(() => { fixture.whenStable().then(() => { expect(component.submitForm.emit).toHaveBeenCalledWith(expectedWithId); }); diff --git a/src/app/+admin/admin-registries/metadata-schema/metadata-schema.component.spec.ts b/src/app/+admin/admin-registries/metadata-schema/metadata-schema.component.spec.ts index 9f14d31aad..8c685c7012 100644 --- a/src/app/+admin/admin-registries/metadata-schema/metadata-schema.component.spec.ts +++ b/src/app/+admin/admin-registries/metadata-schema/metadata-schema.component.spec.ts @@ -1,5 +1,5 @@ import { MetadataSchemaComponent } from './metadata-schema.component'; -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { of as observableOf } from 'rxjs'; import { buildPaginatedList } from '../../../core/data/paginated-list.model'; import { TranslateModule } from '@ngx-translate/core'; @@ -108,10 +108,13 @@ describe('MetadataSchemaComponent', () => { getMetadataSchemaByPrefix: (schemaName: string) => createSuccessfulRemoteDataObject$(mockSchemasList.filter((value) => value.prefix === schemaName)[0]), getActiveMetadataField: () => observableOf(undefined), getSelectedMetadataFields: () => observableOf([]), - editMetadataField: (schema) => {}, - cancelEditMetadataField: () => {}, + editMetadataField: (schema) => { + }, + cancelEditMetadataField: () => { + }, deleteMetadataField: () => observableOf(new RestResponse(true, 200, 'OK')), - deselectAllMetadataField: () => {}, + deselectAllMetadataField: () => { + }, clearMetadataFieldRequests: () => observableOf(undefined) }; /* tslint:enable:no-empty */ @@ -122,7 +125,7 @@ describe('MetadataSchemaComponent', () => { }) }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], declarations: [MetadataSchemaComponent, PaginationComponent, EnumKeysPipe, VarDirective], @@ -175,13 +178,13 @@ describe('MetadataSchemaComponent', () => { fixture.detectChanges(); }); - it('should start editing the selected field', async(() => { + it('should start editing the selected field', waitForAsync(() => { fixture.whenStable().then(() => { expect(registryService.editMetadataField).toHaveBeenCalledWith(mockFieldsList[2] as MetadataField); }); })); - it('should cancel editing the selected field when clicked again', async(() => { + it('should cancel editing the selected field when clicked again', waitForAsync(() => { spyOn(registryService, 'getActiveMetadataField').and.returnValue(observableOf(mockFieldsList[2] as MetadataField)); spyOn(registryService, 'cancelEditMetadataField'); row.click(); @@ -202,7 +205,7 @@ describe('MetadataSchemaComponent', () => { fixture.detectChanges(); }); - it('should call deleteMetadataField with the selected id', async(() => { + it('should call deleteMetadataField with the selected id', waitForAsync(() => { fixture.whenStable().then(() => { expect(registryService.deleteMetadataField).toHaveBeenCalledWith(selectedFields[0].id); }); diff --git a/src/app/+admin/admin-search-page/admin-search-page.component.spec.ts b/src/app/+admin/admin-search-page/admin-search-page.component.spec.ts index 05546d180b..7be486d7da 100644 --- a/src/app/+admin/admin-search-page/admin-search-page.component.spec.ts +++ b/src/app/+admin/admin-search-page/admin-search-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { AdminSearchPageComponent } from './admin-search-page.component'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -7,12 +7,12 @@ describe('AdminSearchPageComponent', () => { let component: AdminSearchPageComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ AdminSearchPageComponent ], + declarations: [AdminSearchPageComponent], schemas: [NO_ERRORS_SCHEMA] }) - .compileComponents(); + .compileComponents(); })); beforeEach(() => { diff --git a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.spec.ts b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.spec.ts index f79ca87a92..38762057ad 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.spec.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { BitstreamDataService } from '../../../../../core/data/bitstream-data.service'; import { mockTruncatableService } from '../../../../../shared/mocks/mock-trucatable.service'; @@ -32,7 +32,7 @@ describe('CollectionAdminSearchResultGridElementComponent', () => { resolveLink: {} }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ @@ -45,7 +45,7 @@ describe('CollectionAdminSearchResultGridElementComponent', () => { providers: [ { provide: TruncatableService, useValue: mockTruncatableService }, { provide: BitstreamDataService, useValue: {} }, - { provide: LinkService, useValue: linkService} + { provide: LinkService, useValue: linkService } ] }) .compileComponents(); diff --git a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.spec.ts b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.spec.ts index 410d25978d..66df215f87 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.spec.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; @@ -34,7 +34,7 @@ describe('CommunityAdminSearchResultGridElementComponent', () => { resolveLink: {} }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ @@ -47,7 +47,7 @@ describe('CommunityAdminSearchResultGridElementComponent', () => { providers: [ { provide: TruncatableService, useValue: mockTruncatableService }, { provide: BitstreamDataService, useValue: {} }, - { provide: LinkService, useValue: linkService} + { provide: LinkService, useValue: linkService } ], schemas: [NO_ERRORS_SCHEMA] }) diff --git a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.spec.ts b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.spec.ts index 6203d3d99e..ccd893e6f0 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.spec.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TranslateModule } from '@ngx-translate/core'; @@ -36,7 +36,7 @@ describe('ItemAdminSearchResultGridElementComponent', () => { searchResult.indexableObject.uuid = id; } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule( { diff --git a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.spec.ts b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.spec.ts index f0b32bbcca..218cbc0ca2 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.spec.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { CollectionAdminSearchResultListElementComponent } from './collection-admin-search-result-list-element.component'; @@ -24,7 +24,8 @@ describe('CollectionAdminSearchResultListElementComponent', () => { searchResult.indexableObject = new Collection(); searchResult.indexableObject.uuid = id; } - beforeEach(async(() => { + + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ diff --git a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.spec.ts b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.spec.ts index 4776b982cb..69fe8856dd 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.spec.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; @@ -24,7 +24,8 @@ describe('CommunityAdminSearchResultListElementComponent', () => { searchResult.indexableObject = new Community(); searchResult.indexableObject.uuid = id; } - beforeEach(async(() => { + + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ diff --git a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/item-search-result/item-admin-search-result-list-element.component.spec.ts b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/item-search-result/item-admin-search-result-list-element.component.spec.ts index f1decc9ed8..1d2f25c2eb 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/item-search-result/item-admin-search-result-list-element.component.spec.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/item-search-result/item-admin-search-result-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service'; @@ -22,7 +22,7 @@ describe('ItemAdminSearchResultListElementComponent', () => { searchResult.indexableObject.uuid = id; } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ diff --git a/src/app/+admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.spec.ts b/src/app/+admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.spec.ts index 3cf6d028f3..52a9366ecc 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.spec.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; @@ -9,10 +9,10 @@ import { Item } from '../../../core/shared/item.model'; import { URLCombiner } from '../../../core/url-combiner/url-combiner'; import { getItemEditRoute } from '../../../+item-page/item-page-routing-paths'; import { - ITEM_EDIT_MOVE_PATH, ITEM_EDIT_DELETE_PATH, - ITEM_EDIT_PUBLIC_PATH, + ITEM_EDIT_MOVE_PATH, ITEM_EDIT_PRIVATE_PATH, + ITEM_EDIT_PUBLIC_PATH, ITEM_EDIT_REINSTATE_PATH, ITEM_EDIT_WITHDRAW_PATH } from '../../../+item-page/edit-item-page/edit-item-page.routing-paths'; @@ -28,7 +28,8 @@ describe('ItemAdminSearchResultActionsComponent', () => { item = new Item(); item.uuid = id; } - beforeEach(async(() => { + + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ @@ -72,8 +73,8 @@ describe('ItemAdminSearchResultActionsComponent', () => { describe('when the item is not withdrawn', () => { beforeEach(() => { - component.item.isWithdrawn = false; - fixture.detectChanges(); + component.item.isWithdrawn = false; + fixture.detectChanges(); }); it('should render a withdraw button with the correct link', () => { diff --git a/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.spec.ts b/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.spec.ts index 8a48169a23..14d5d38199 100644 --- a/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.spec.ts +++ b/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { MenuService } from '../../../shared/menu/menu.service'; import { MenuServiceStub } from '../../../shared/testing/menu-service.stub'; @@ -17,7 +17,7 @@ describe('AdminSidebarSectionComponent', () => { const menuService = new MenuServiceStub(); const iconString = 'test'; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule, RouterTestingModule, TranslateModule.forRoot()], declarations: [AdminSidebarSectionComponent, TestComponent], diff --git a/src/app/+admin/admin-sidebar/admin-sidebar.component.spec.ts b/src/app/+admin/admin-sidebar/admin-sidebar.component.spec.ts index 140dd4a63f..ec571ff3d5 100644 --- a/src/app/+admin/admin-sidebar/admin-sidebar.component.spec.ts +++ b/src/app/+admin/admin-sidebar/admin-sidebar.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TranslateModule } from '@ngx-translate/core'; import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core'; @@ -24,7 +24,7 @@ describe('AdminSidebarComponent', () => { let authorizationService: AuthorizationDataService; let scriptService; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { authorizationService = jasmine.createSpyObj('authorizationService', { isAuthorized: observableOf(true) }); diff --git a/src/app/+admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.spec.ts b/src/app/+admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.spec.ts index 8e3684cc76..33374f1f46 100644 --- a/src/app/+admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.spec.ts +++ b/src/app/+admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ExpandableAdminSidebarSectionComponent } from './expandable-admin-sidebar-section.component'; import { MenuService } from '../../../shared/menu/menu.service'; @@ -16,12 +16,12 @@ describe('ExpandableAdminSidebarSectionComponent', () => { let fixture: ComponentFixture; const menuService = new MenuServiceStub(); const iconString = 'test'; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule, TranslateModule.forRoot()], declarations: [ExpandableAdminSidebarSectionComponent, TestComponent], providers: [ - { provide: 'sectionDataProvider', useValue: {icon: iconString} }, + { provide: 'sectionDataProvider', useValue: { icon: iconString } }, { provide: MenuService, useValue: menuService }, { provide: CSSVariableService, useClass: CSSVariableServiceStub }, ] @@ -54,7 +54,10 @@ describe('ExpandableAdminSidebarSectionComponent', () => { beforeEach(() => { spyOn(menuService, 'toggleActiveSection'); const sidebarToggler = fixture.debugElement.query(By.css('a.shortcut-icon')); - sidebarToggler.triggerEventHandler('click', {preventDefault: () => {/**/}}); + sidebarToggler.triggerEventHandler('click', { + preventDefault: () => {/**/ + } + }); }); it('should call toggleActiveSection on the menuService', () => { @@ -66,7 +69,10 @@ describe('ExpandableAdminSidebarSectionComponent', () => { beforeEach(() => { spyOn(menuService, 'toggleActiveSection'); const sidebarToggler = fixture.debugElement.query(By.css('.sidebar-collapsible')).query(By.css('a')); - sidebarToggler.triggerEventHandler('click', {preventDefault: () => {/**/}}); + sidebarToggler.triggerEventHandler('click', { + preventDefault: () => {/**/ + } + }); }); it('should call toggleActiveSection on the menuService', () => { diff --git a/src/app/+admin/admin-workflow-page/admin-workflow-page.component.spec.ts b/src/app/+admin/admin-workflow-page/admin-workflow-page.component.spec.ts index d329497473..c80bc677f2 100644 --- a/src/app/+admin/admin-workflow-page/admin-workflow-page.component.spec.ts +++ b/src/app/+admin/admin-workflow-page/admin-workflow-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { AdminWorkflowPageComponent } from './admin-workflow-page.component'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -7,12 +7,12 @@ describe('AdminSearchPageComponent', () => { let component: AdminWorkflowPageComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ AdminWorkflowPageComponent ], + declarations: [AdminWorkflowPageComponent], schemas: [NO_ERRORS_SCHEMA] }) - .compileComponents(); + .compileComponents(); })); beforeEach(() => { diff --git a/src/app/+admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-search-result-admin-workflow-grid-element.component.spec.ts b/src/app/+admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-search-result-admin-workflow-grid-element.component.spec.ts index 3ae11e792c..fe3e0ff3de 100644 --- a/src/app/+admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-search-result-admin-workflow-grid-element.component.spec.ts +++ b/src/app/+admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-search-result-admin-workflow-grid-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; @@ -39,7 +39,7 @@ describe('WorkflowItemAdminWorkflowGridElementComponent', () => { linkService = getMockLinkService(); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule( { @@ -51,9 +51,11 @@ describe('WorkflowItemAdminWorkflowGridElementComponent', () => { ], providers: [ { provide: LinkService, useValue: linkService }, - { provide: TruncatableService, useValue: { + { + provide: TruncatableService, useValue: { isCollapsed: () => observableOf(true), - } }, + } + }, { provide: BitstreamDataService, useValue: {} }, ], schemas: [NO_ERRORS_SCHEMA] diff --git a/src/app/+admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-list-element/workflow-item/workflow-item-search-result-admin-workflow-list-element.component.spec.ts b/src/app/+admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-list-element/workflow-item/workflow-item-search-result-admin-workflow-list-element.component.spec.ts index 7114ce6871..47907999a2 100644 --- a/src/app/+admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-list-element/workflow-item/workflow-item-search-result-admin-workflow-list-element.component.spec.ts +++ b/src/app/+admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-list-element/workflow-item/workflow-item-search-result-admin-workflow-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; @@ -36,7 +36,7 @@ describe('WorkflowItemAdminWorkflowListElementComponent', () => { linkService = getMockLinkService(); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule( { diff --git a/src/app/+admin/admin-workflow-page/admin-workflow-search-results/workflow-item-admin-workflow-actions.component.spec.ts b/src/app/+admin/admin-workflow-page/admin-workflow-search-results/workflow-item-admin-workflow-actions.component.spec.ts index 5e0ff481a0..cb1a0c9cdf 100644 --- a/src/app/+admin/admin-workflow-page/admin-workflow-search-results/workflow-item-admin-workflow-actions.component.spec.ts +++ b/src/app/+admin/admin-workflow-page/admin-workflow-search-results/workflow-item-admin-workflow-actions.component.spec.ts @@ -1,26 +1,16 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; -import { Item } from '../../../core/shared/item.model'; import { URLCombiner } from '../../../core/url-combiner/url-combiner'; import { WorkflowItemAdminWorkflowActionsComponent } from './workflow-item-admin-workflow-actions.component'; import { WorkflowItem } from '../../../core/submission/models/workflowitem.model'; import { - getWorkflowItemSendBackRoute, - getWorkflowItemDeleteRoute + getWorkflowItemDeleteRoute, + getWorkflowItemSendBackRoute } from '../../../+workflowitems-edit-page/workflowitems-edit-page-routing-paths'; -import { getItemEditRoute } from '../../../+item-page/item-page-routing-paths'; -import { - ITEM_EDIT_MOVE_PATH, - ITEM_EDIT_DELETE_PATH, - ITEM_EDIT_PUBLIC_PATH, - ITEM_EDIT_PRIVATE_PATH, - ITEM_EDIT_REINSTATE_PATH, - ITEM_EDIT_WITHDRAW_PATH -} from '../../../+item-page/edit-item-page/edit-item-page.routing-paths'; describe('WorkflowItemAdminWorkflowActionsComponent', () => { let component: WorkflowItemAdminWorkflowActionsComponent; @@ -33,7 +23,8 @@ describe('WorkflowItemAdminWorkflowActionsComponent', () => { wfi = new WorkflowItem(); wfi.id = id; } - beforeEach(async(() => { + + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ diff --git a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts index 61bb263f1e..49fdfc6115 100644 --- a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts +++ b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts @@ -1,5 +1,5 @@ import { EditBitstreamPageComponent } from './edit-bitstream-page.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { RouterTestingModule } from '@angular/router/testing'; import { ActivatedRoute, Router } from '@angular/router'; @@ -18,10 +18,7 @@ import { hasValue } from '../../shared/empty.util'; import { FormControl, FormGroup } from '@angular/forms'; import { FileSizePipe } from '../../shared/utils/file-size-pipe'; import { VarDirective } from '../../shared/utils/var.directive'; -import { - createSuccessfulRemoteDataObject, - createSuccessfulRemoteDataObject$ -} from '../../shared/remote-data.utils'; +import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils'; import { RouterStub } from '../../shared/testing/router.stub'; import { getItemEditRoute } from '../../+item-page/item-page-routing-paths'; import { createPaginatedList } from '../../shared/testing/utils.test'; @@ -44,7 +41,7 @@ describe('EditBitstreamPageComponent', () => { let comp: EditBitstreamPageComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { allFormats = [ Object.assign({ id: '1', diff --git a/src/app/+browse-by/+browse-by-date-page/browse-by-date-page.component.spec.ts b/src/app/+browse-by/+browse-by-date-page/browse-by-date-page.component.spec.ts index 207e23adc0..87473a876b 100644 --- a/src/app/+browse-by/+browse-by-date-page/browse-by-date-page.component.spec.ts +++ b/src/app/+browse-by/+browse-by-date-page/browse-by-date-page.component.spec.ts @@ -1,5 +1,5 @@ import { BrowseByDatePageComponent } from './browse-by-date-page.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { CommonModule } from '@angular/common'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; @@ -65,7 +65,7 @@ describe('BrowseByDatePageComponent', () => { detectChanges: () => fixture.detectChanges() }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], declarations: [BrowseByDatePageComponent, EnumKeysPipe, VarDirective], diff --git a/src/app/+browse-by/+browse-by-metadata-page/browse-by-metadata-page.component.spec.ts b/src/app/+browse-by/+browse-by-metadata-page/browse-by-metadata-page.component.spec.ts index b3a7c39d0c..faa75af2f2 100644 --- a/src/app/+browse-by/+browse-by-metadata-page/browse-by-metadata-page.component.spec.ts +++ b/src/app/+browse-by/+browse-by-metadata-page/browse-by-metadata-page.component.spec.ts @@ -1,5 +1,5 @@ import { BrowseByMetadataPageComponent, browseParamsToOptions } from './browse-by-metadata-page.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { BrowseService } from '../../core/browse/browse.service'; import { CommonModule } from '@angular/common'; import { RouterTestingModule } from '@angular/router/testing'; @@ -11,7 +11,7 @@ import { ActivatedRouteStub } from '../../shared/testing/active-router.stub'; import { Observable, of as observableOf } from 'rxjs'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { RemoteData } from '../../core/data/remote-data'; -import { PaginatedList, buildPaginatedList } from '../../core/data/paginated-list.model'; +import { buildPaginatedList, PaginatedList } from '../../core/data/paginated-list.model'; import { PageInfo } from '../../core/shared/page-info.model'; import { BrowseEntrySearchOptions } from '../../core/browse/browse-entry-search-options.model'; import { SortDirection } from '../../core/cache/models/sort-options.model'; @@ -82,7 +82,7 @@ describe('BrowseByMetadataPageComponent', () => { params: observableOf({}) }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], declarations: [BrowseByMetadataPageComponent, EnumKeysPipe, VarDirective], diff --git a/src/app/+browse-by/+browse-by-switcher/browse-by-switcher.component.spec.ts b/src/app/+browse-by/+browse-by-switcher/browse-by-switcher.component.spec.ts index 6c994e2082..545b766c88 100644 --- a/src/app/+browse-by/+browse-by-switcher/browse-by-switcher.component.spec.ts +++ b/src/app/+browse-by/+browse-by-switcher/browse-by-switcher.component.spec.ts @@ -1,11 +1,11 @@ import { BrowseBySwitcherComponent } from './browse-by-switcher.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import * as decorator from './browse-by-decorator'; -import createSpy = jasmine.createSpy; import { BehaviorSubject } from 'rxjs'; import { environment } from '../../../environments/environment'; +import createSpy = jasmine.createSpy; xdescribe('BrowseBySwitcherComponent', () => { let comp: BrowseBySwitcherComponent; @@ -19,17 +19,17 @@ xdescribe('BrowseBySwitcherComponent', () => { params: params }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ BrowseBySwitcherComponent ], + declarations: [BrowseBySwitcherComponent], providers: [ { provide: ActivatedRoute, useValue: activatedRouteStub } ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(BrowseBySwitcherComponent); comp = fixture.componentInstance; spyOnProperty(decorator, 'getComponentByBrowseByType').and.returnValue(createSpy('getComponentByItemType')); diff --git a/src/app/+browse-by/+browse-by-title-page/browse-by-title-page.component.spec.ts b/src/app/+browse-by/+browse-by-title-page/browse-by-title-page.component.spec.ts index 729effb72a..4f7b2d5255 100644 --- a/src/app/+browse-by/+browse-by-title-page/browse-by-title-page.component.spec.ts +++ b/src/app/+browse-by/+browse-by-title-page/browse-by-title-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { Item } from '../../core/shared/item.model'; import { ActivatedRouteStub } from '../../shared/testing/active-router.stub'; @@ -61,7 +61,7 @@ describe('BrowseByTitlePageComponent', () => { data: observableOf({ metadata: 'title' }) }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], declarations: [BrowseByTitlePageComponent, EnumKeysPipe, VarDirective], diff --git a/src/app/+browse-by/browse-by-guard.spec.ts b/src/app/+browse-by/browse-by-guard.spec.ts index ee459887ab..4592f47175 100644 --- a/src/app/+browse-by/browse-by-guard.spec.ts +++ b/src/app/+browse-by/browse-by-guard.spec.ts @@ -46,13 +46,13 @@ describe('BrowseByGuard', () => { .subscribe( (canActivate) => { const result = { - title, - id, - metadataField, - collection: name, - field, - value: '"' + value + '"' - }; + title, + id, + metadataField, + collection: name, + field, + value: '"' + value + '"' + }; expect(scopedRoute.data).toEqual(result); expect(canActivate).toEqual(true); } @@ -78,13 +78,13 @@ describe('BrowseByGuard', () => { .subscribe( (canActivate) => { const result = { - title, - id, - metadataField, - collection: name, - field, - value: '' - }; + title, + id, + metadataField, + collection: name, + field, + value: '' + }; expect(scopedNoValueRoute.data).toEqual(result); expect(canActivate).toEqual(true); } @@ -109,13 +109,13 @@ describe('BrowseByGuard', () => { .subscribe( (canActivate) => { const result = { - title, - id, - metadataField, - collection: '', - field, - value: '"' + value + '"' - }; + title, + id, + metadataField, + collection: '', + field, + value: '"' + value + '"' + }; expect(route.data).toEqual(result); expect(canActivate).toEqual(true); } diff --git a/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.spec.ts b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.spec.ts index 3c95f0fbfd..7cd7871f6d 100644 --- a/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.spec.ts +++ b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.spec.ts @@ -1,5 +1,5 @@ import { CollectionItemMapperComponent } from './collection-item-mapper.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { CommonModule } from '@angular/common'; @@ -122,7 +122,7 @@ describe('CollectionItemMapperComponent', () => { } }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [CommonModule, FormsModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], declarations: [CollectionItemMapperComponent, ItemSelectComponent, SearchFormComponent, PaginationComponent, EnumKeysPipe, VarDirective, ErrorComponent, LoadingComponent], diff --git a/src/app/+collection-page/create-collection-page/create-collection-page.component.spec.ts b/src/app/+collection-page/create-collection-page/create-collection-page.component.spec.ts index 2064c2188b..03c01c7f46 100644 --- a/src/app/+collection-page/create-collection-page/create-collection-page.component.spec.ts +++ b/src/app/+collection-page/create-collection-page/create-collection-page.component.spec.ts @@ -1,5 +1,5 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { ActivatedRoute, Router } from '@angular/router'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { Router } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; import { CommonModule } from '@angular/common'; import { RouterTestingModule } from '@angular/router/testing'; @@ -12,13 +12,13 @@ import { CommunityDataService } from '../../core/data/community-data.service'; import { CreateCollectionPageComponent } from './create-collection-page.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub'; -import {RequestService} from '../../core/data/request.service'; +import { RequestService } from '../../core/data/request.service'; describe('CreateCollectionPageComponent', () => { let comp: CreateCollectionPageComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], declarations: [CreateCollectionPageComponent], diff --git a/src/app/+collection-page/delete-collection-page/delete-collection-page.component.spec.ts b/src/app/+collection-page/delete-collection-page/delete-collection-page.component.spec.ts index a899828b18..48ac9b7530 100644 --- a/src/app/+collection-page/delete-collection-page/delete-collection-page.component.spec.ts +++ b/src/app/+collection-page/delete-collection-page/delete-collection-page.component.spec.ts @@ -1,5 +1,5 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { ActivatedRoute, Router } from '@angular/router'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { ActivatedRoute } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; import { CommonModule } from '@angular/common'; import { RouterTestingModule } from '@angular/router/testing'; @@ -9,13 +9,13 @@ import { of as observableOf } from 'rxjs'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { DeleteCollectionPageComponent } from './delete-collection-page.component'; import { CollectionDataService } from '../../core/data/collection-data.service'; -import {RequestService} from '../../core/data/request.service'; +import { RequestService } from '../../core/data/request.service'; describe('DeleteCollectionPageComponent', () => { let comp: DeleteCollectionPageComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], declarations: [DeleteCollectionPageComponent], diff --git a/src/app/+collection-page/edit-collection-page/collection-authorizations/collection-authorizations.component.spec.ts b/src/app/+collection-page/edit-collection-page/collection-authorizations/collection-authorizations.component.spec.ts index 39f1ee6551..c8e529443a 100644 --- a/src/app/+collection-page/edit-collection-page/collection-authorizations/collection-authorizations.component.spec.ts +++ b/src/app/+collection-page/edit-collection-page/collection-authorizations/collection-authorizations.component.spec.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { ChangeDetectorRef, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; import { cold } from 'jasmine-marbles'; @@ -35,7 +35,7 @@ describe('CollectionAuthorizationsComponent', () => { } }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ CommonModule diff --git a/src/app/+collection-page/edit-collection-page/collection-curate/collection-curate.component.spec.ts b/src/app/+collection-page/edit-collection-page/collection-curate/collection-curate.component.spec.ts index 628dd545df..2cf25734e1 100644 --- a/src/app/+collection-page/edit-collection-page/collection-curate/collection-curate.component.spec.ts +++ b/src/app/+collection-page/edit-collection-page/collection-curate/collection-curate.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { CUSTOM_ELEMENTS_SCHEMA, DebugElement } from '@angular/core'; import { CollectionCurateComponent } from './collection-curate.component'; @@ -20,7 +20,7 @@ describe('CollectionCurateComponent', () => { metadata: {'dc.title': ['Collection Name'], 'dc.identifier.uri': [ { value: '123456789/1'}]} }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { routeStub = { parent: { data: observableOf({ diff --git a/src/app/+collection-page/edit-collection-page/collection-metadata/collection-metadata.component.spec.ts b/src/app/+collection-page/edit-collection-page/collection-metadata/collection-metadata.component.spec.ts index 05065a20e3..2c2dbf57dd 100644 --- a/src/app/+collection-page/edit-collection-page/collection-metadata/collection-metadata.component.spec.ts +++ b/src/app/+collection-page/edit-collection-page/collection-metadata/collection-metadata.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { SharedModule } from '../../../shared/shared.module'; import { CommonModule } from '@angular/common'; @@ -53,7 +53,7 @@ describe('CollectionMetadataComponent', () => { removeByHrefSubstring: {} }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], declarations: [CollectionMetadataComponent], diff --git a/src/app/+collection-page/edit-collection-page/collection-source/collection-source.component.spec.ts b/src/app/+collection-page/edit-collection-page/collection-source/collection-source.component.spec.ts index 2f5036cfb2..869238b956 100644 --- a/src/app/+collection-page/edit-collection-page/collection-source/collection-source.component.spec.ts +++ b/src/app/+collection-page/edit-collection-page/collection-source/collection-source.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { RouterTestingModule } from '@angular/router/testing'; import { ActivatedRoute, Router } from '@angular/router'; @@ -42,7 +42,7 @@ describe('CollectionSourceComponent', () => { let comp: CollectionSourceComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { date = new Date(); contentSource = Object.assign(new ContentSource(), { uuid: uuid, diff --git a/src/app/+collection-page/edit-collection-page/edit-collection-page.component.spec.ts b/src/app/+collection-page/edit-collection-page/edit-collection-page.component.spec.ts index f21fc28817..37adf4dece 100644 --- a/src/app/+collection-page/edit-collection-page/edit-collection-page.component.spec.ts +++ b/src/app/+collection-page/edit-collection-page/edit-collection-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; import { CommonModule } from '@angular/common'; @@ -29,7 +29,7 @@ describe('EditCollectionPageComponent', () => { } }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], declarations: [EditCollectionPageComponent], diff --git a/src/app/+collection-page/edit-item-template-page/edit-item-template-page.component.spec.ts b/src/app/+collection-page/edit-item-template-page/edit-item-template-page.component.spec.ts index 56e8156c98..81bb7ea867 100644 --- a/src/app/+collection-page/edit-item-template-page/edit-item-template-page.component.spec.ts +++ b/src/app/+collection-page/edit-item-template-page/edit-item-template-page.component.spec.ts @@ -1,5 +1,5 @@ import { EditItemTemplatePageComponent } from './edit-item-template-page.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { SharedModule } from '../../shared/shared.module'; import { RouterTestingModule } from '@angular/router/testing'; @@ -18,7 +18,7 @@ describe('EditItemTemplatePageComponent', () => { let itemTemplateService: ItemTemplateDataService; let collection: Collection; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { collection = Object.assign(new Collection(), { uuid: 'collection-id', id: 'collection-id', diff --git a/src/app/+community-page/create-community-page/create-community-page.component.spec.ts b/src/app/+community-page/create-community-page/create-community-page.component.spec.ts index d84c69c689..fbff82efd8 100644 --- a/src/app/+community-page/create-community-page/create-community-page.component.spec.ts +++ b/src/app/+community-page/create-community-page/create-community-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { Router } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; import { CommonModule } from '@angular/common'; @@ -6,19 +6,18 @@ import { RouterTestingModule } from '@angular/router/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { RouteService } from '../../core/services/route.service'; import { SharedModule } from '../../shared/shared.module'; -import { CollectionDataService } from '../../core/data/collection-data.service'; import { of as observableOf } from 'rxjs'; import { CommunityDataService } from '../../core/data/community-data.service'; import { CreateCommunityPageComponent } from './create-community-page.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub'; -import {RequestService} from '../../core/data/request.service'; +import { RequestService } from '../../core/data/request.service'; describe('CreateCommunityPageComponent', () => { let comp: CreateCommunityPageComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], declarations: [CreateCommunityPageComponent], diff --git a/src/app/+community-page/create-community-page/create-community-page.component.ts b/src/app/+community-page/create-community-page/create-community-page.component.ts index f9ed09f1cd..be3385b92f 100644 --- a/src/app/+community-page/create-community-page/create-community-page.component.ts +++ b/src/app/+community-page/create-community-page/create-community-page.component.ts @@ -6,7 +6,7 @@ import { Router } from '@angular/router'; import { CreateComColPageComponent } from '../../shared/comcol-forms/create-comcol-page/create-comcol-page.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { TranslateService } from '@ngx-translate/core'; -import {RequestService} from '../../core/data/request.service'; +import { RequestService } from '../../core/data/request.service'; /** * Component that represents the page where a user can create a new Community diff --git a/src/app/+community-page/create-community-page/create-community-page.guard.spec.ts b/src/app/+community-page/create-community-page/create-community-page.guard.spec.ts index ac0b196c72..8c7b994a85 100644 --- a/src/app/+community-page/create-community-page/create-community-page.guard.spec.ts +++ b/src/app/+community-page/create-community-page/create-community-page.guard.spec.ts @@ -2,10 +2,7 @@ import { CreateCommunityPageGuard } from './create-community-page.guard'; import { RouterMock } from '../../shared/mocks/router.mock'; import { Community } from '../../core/shared/community.model'; import { first } from 'rxjs/operators'; -import { - createFailedRemoteDataObject$, - createSuccessfulRemoteDataObject$ -} from '../../shared/remote-data.utils'; +import { createFailedRemoteDataObject$, createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils'; describe('CreateCommunityPageGuard', () => { describe('canActivate', () => { diff --git a/src/app/+community-page/delete-community-page/delete-community-page.component.spec.ts b/src/app/+community-page/delete-community-page/delete-community-page.component.spec.ts index 4af0d4493a..da9c80dcfa 100644 --- a/src/app/+community-page/delete-community-page/delete-community-page.component.spec.ts +++ b/src/app/+community-page/delete-community-page/delete-community-page.component.spec.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; @@ -9,13 +9,13 @@ import { CommunityDataService } from '../../core/data/community-data.service'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { SharedModule } from '../../shared/shared.module'; import { DeleteCommunityPageComponent } from './delete-community-page.component'; -import {RequestService} from '../../core/data/request.service'; +import { RequestService } from '../../core/data/request.service'; describe('DeleteCommunityPageComponent', () => { let comp: DeleteCommunityPageComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], declarations: [DeleteCommunityPageComponent], diff --git a/src/app/+community-page/edit-community-page/community-authorizations/community-authorizations.component.spec.ts b/src/app/+community-page/edit-community-page/community-authorizations/community-authorizations.component.spec.ts index dd10bdce29..719cf83a26 100644 --- a/src/app/+community-page/edit-community-page/community-authorizations/community-authorizations.component.spec.ts +++ b/src/app/+community-page/edit-community-page/community-authorizations/community-authorizations.component.spec.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { ChangeDetectorRef, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; import { cold } from 'jasmine-marbles'; @@ -35,7 +35,7 @@ describe('CommunityAuthorizationsComponent', () => { } }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ CommonModule diff --git a/src/app/+community-page/edit-community-page/community-curate/community-curate.component.spec.ts b/src/app/+community-page/edit-community-page/community-curate/community-curate.component.spec.ts index 3217fee3c1..1b1ee2c9f9 100644 --- a/src/app/+community-page/edit-community-page/community-curate/community-curate.component.spec.ts +++ b/src/app/+community-page/edit-community-page/community-curate/community-curate.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { CUSTOM_ELEMENTS_SCHEMA, DebugElement } from '@angular/core'; import { of as observableOf } from 'rxjs'; @@ -20,7 +20,7 @@ describe('CommunityCurateComponent', () => { metadata: {'dc.title': ['Community Name'], 'dc.identifier.uri': [ { value: '123456789/1'}]} }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { routeStub = { parent: { data: observableOf({ diff --git a/src/app/+community-page/edit-community-page/community-metadata/community-metadata.component.spec.ts b/src/app/+community-page/edit-community-page/community-metadata/community-metadata.component.spec.ts index 1fc94e3583..c597fac0bd 100644 --- a/src/app/+community-page/edit-community-page/community-metadata/community-metadata.component.spec.ts +++ b/src/app/+community-page/edit-community-page/community-metadata/community-metadata.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { SharedModule } from '../../../shared/shared.module'; import { CommonModule } from '@angular/common'; @@ -15,7 +15,7 @@ describe('CommunityMetadataComponent', () => { let comp: CommunityMetadataComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], declarations: [CommunityMetadataComponent], diff --git a/src/app/+community-page/edit-community-page/edit-community-page.component.spec.ts b/src/app/+community-page/edit-community-page/edit-community-page.component.spec.ts index d120212f8f..bea310c8fb 100644 --- a/src/app/+community-page/edit-community-page/edit-community-page.component.spec.ts +++ b/src/app/+community-page/edit-community-page/edit-community-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; import { CommonModule } from '@angular/common'; @@ -29,7 +29,7 @@ describe('EditCommunityPageComponent', () => { } }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], declarations: [EditCommunityPageComponent], diff --git a/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.spec.ts b/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.spec.ts index c6e7f7c026..73e96fcc9c 100644 --- a/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.spec.ts +++ b/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; @@ -110,7 +110,7 @@ describe('CommunityPageSubCollectionList Component', () => { } }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot(), diff --git a/src/app/+community-page/sub-community-list/community-page-sub-community-list.component.spec.ts b/src/app/+community-page/sub-community-list/community-page-sub-community-list.component.spec.ts index eb9d5643c4..b52df64db7 100644 --- a/src/app/+community-page/sub-community-list/community-page-sub-community-list.component.spec.ts +++ b/src/app/+community-page/sub-community-list/community-page-sub-community-list.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { RouterTestingModule } from '@angular/router/testing'; @@ -111,7 +111,7 @@ describe('CommunityPageSubCommunityListComponent Component', () => { } }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot(), diff --git a/src/app/+home-page/top-level-community-list/top-level-community-list.component.spec.ts b/src/app/+home-page/top-level-community-list/top-level-community-list.component.spec.ts index 808abe3930..4e0b8d4d22 100644 --- a/src/app/+home-page/top-level-community-list/top-level-community-list.component.spec.ts +++ b/src/app/+home-page/top-level-community-list/top-level-community-list.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { RouterTestingModule } from '@angular/router/testing'; @@ -101,7 +101,7 @@ describe('TopLevelCommunityList Component', () => { } }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot(), @@ -140,7 +140,7 @@ describe('TopLevelCommunityList Component', () => { it('should update list of top-communities on pagination change', () => { const pagination = Object.create({ - pagination:{ + pagination: { id: comp.pageId, currentPage: 2, pageSize: 5 diff --git a/src/app/+import-external-page/import-external-page.component.spec.ts b/src/app/+import-external-page/import-external-page.component.spec.ts index 5a2b7c5f8e..a19c22d71e 100644 --- a/src/app/+import-external-page/import-external-page.component.spec.ts +++ b/src/app/+import-external-page/import-external-page.component.spec.ts @@ -1,12 +1,12 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { ImportExternalPageComponent } from './import-external-page.component'; describe('ImportExternalPageComponent', () => { let component: ImportExternalPageComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ ImportExternalPageComponent ], schemas: [NO_ERRORS_SCHEMA] diff --git a/src/app/+item-page/bitstreams/upload/upload-bitstream.component.spec.ts b/src/app/+item-page/bitstreams/upload/upload-bitstream.component.spec.ts index 5d71b54741..35546a63d6 100644 --- a/src/app/+item-page/bitstreams/upload/upload-bitstream.component.spec.ts +++ b/src/app/+item-page/bitstreams/upload/upload-bitstream.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { CommonModule } from '@angular/common'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; @@ -16,10 +16,7 @@ import { Bitstream } from '../../../core/shared/bitstream.model'; import { BundleDataService } from '../../../core/data/bundle-data.service'; import { Bundle } from '../../../core/shared/bundle.model'; import { RequestService } from '../../../core/data/request.service'; -import { - createSuccessfulRemoteDataObject, - createSuccessfulRemoteDataObject$ -} from '../../../shared/remote-data.utils'; +import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils'; import { createPaginatedList } from '../../../shared/testing/utils.test'; import { RouterStub } from '../../../shared/testing/router.stub'; import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub'; @@ -96,7 +93,7 @@ describe('UploadBistreamComponent', () => { }); describe('when a file is uploaded', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { createUploadBitstreamTestingModule({}); })); @@ -130,7 +127,7 @@ describe('UploadBistreamComponent', () => { }); describe('when a bundle url parameter is present', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { createUploadBitstreamTestingModule({ bundle: bundle.id }); @@ -160,7 +157,7 @@ describe('UploadBistreamComponent', () => { }); describe('when a name is filled in, but no ID is selected', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { createUploadBitstreamTestingModule({}); })); diff --git a/src/app/+item-page/edit-item-page/item-authorizations/item-authorizations.component.spec.ts b/src/app/+item-page/edit-item-page/item-authorizations/item-authorizations.component.spec.ts index 915d4e17e5..97280c3ea0 100644 --- a/src/app/+item-page/edit-item-page/item-authorizations/item-authorizations.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-authorizations/item-authorizations.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, inject, TestBed } from '@angular/core/testing'; import { Component, NO_ERRORS_SCHEMA } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; @@ -75,7 +75,7 @@ describe('ItemAuthorizationsComponent test suite', () => { }) }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ NoopAnimationsModule, diff --git a/src/app/+item-page/edit-item-page/item-bitstreams/item-bitstreams.component.spec.ts b/src/app/+item-page/edit-item-page/item-bitstreams/item-bitstreams.component.spec.ts index ce392ea9b1..e4e0932ce8 100644 --- a/src/app/+item-page/edit-item-page/item-bitstreams/item-bitstreams.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-bitstreams/item-bitstreams.component.spec.ts @@ -1,7 +1,7 @@ import { Bitstream } from '../../../core/shared/bitstream.model'; import { of as observableOf } from 'rxjs'; import { Item } from '../../../core/shared/item.model'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ItemBitstreamsComponent } from './item-bitstreams.component'; import { ItemDataService } from '../../../core/data/item-data.service'; import { TranslateModule } from '@ngx-translate/core'; @@ -10,10 +10,7 @@ import { ActivatedRoute, Router } from '@angular/router'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { ChangeDetectorRef, NO_ERRORS_SCHEMA } from '@angular/core'; import { FieldChangeType } from '../../../core/data/object-updates/object-updates.actions'; -import { - INotification, - Notification -} from '../../../shared/notifications/models/notification.model'; +import { INotification, Notification } from '../../../shared/notifications/models/notification.model'; import { NotificationType } from '../../../shared/notifications/models/notification-type'; import { BitstreamDataService } from '../../../core/data/bitstream-data.service'; import { ObjectCacheService } from '../../../core/cache/object-cache.service'; @@ -26,10 +23,7 @@ import { RestResponse } from '../../../core/cache/response.models'; import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service'; import { RouterStub } from '../../../shared/testing/router.stub'; import { getMockRequestService } from '../../../shared/mocks/request.service.mock'; -import { - createSuccessfulRemoteDataObject, - createSuccessfulRemoteDataObject$ -} from '../../../shared/remote-data.utils'; +import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils'; import { createPaginatedList } from '../../../shared/testing/utils.test'; let comp: ItemBitstreamsComponent; @@ -84,7 +78,7 @@ let searchConfig: SearchConfigurationService; let bundleService: BundleDataService; describe('ItemBitstreamsComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { objectUpdatesService = jasmine.createSpyObj('objectUpdatesService', { getFieldUpdates: observableOf({ @@ -125,7 +119,7 @@ describe('ItemBitstreamsComponent', () => { remove: jasmine.createSpy('remove') }); requestService = getMockRequestService(); - searchConfig = Object.assign( { + searchConfig = Object.assign({ paginatedSearchOptions: observableOf({}) }); @@ -138,7 +132,7 @@ describe('ItemBitstreamsComponent', () => { bundles: createSuccessfulRemoteDataObject$(createPaginatedList([bundle])), lastModified: date }); - itemService = Object.assign( { + itemService = Object.assign({ getBitstreams: () => createSuccessfulRemoteDataObject$(createPaginatedList([bitstream1, bitstream2])), findById: () => createSuccessfulRemoteDataObject$(item), getBundles: () => createSuccessfulRemoteDataObject$(createPaginatedList([bundle])) @@ -201,7 +195,8 @@ describe('ItemBitstreamsComponent', () => { fromIndex: 0, toIndex: 50, // tslint:disable-next-line:no-empty - finish: () => {} + finish: () => { + } }; beforeEach(() => { diff --git a/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/item-edit-bitstream-bundle.component.spec.ts b/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/item-edit-bitstream-bundle.component.spec.ts index e15a9d7996..c26f99eb8f 100644 --- a/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/item-edit-bitstream-bundle.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/item-edit-bitstream-bundle.component.spec.ts @@ -1,5 +1,5 @@ import { ItemEditBitstreamBundleComponent } from './item-edit-bitstream-bundle.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { NO_ERRORS_SCHEMA, ViewContainerRef } from '@angular/core'; import { Item } from '../../../../core/shared/item.model'; @@ -31,7 +31,7 @@ describe('ItemEditBitstreamBundleComponent', () => { } }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], declarations: [ItemEditBitstreamBundleComponent], diff --git a/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/paginated-drag-and-drop-bitstream-list/paginated-drag-and-drop-bitstream-list.component.spec.ts b/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/paginated-drag-and-drop-bitstream-list/paginated-drag-and-drop-bitstream-list.component.spec.ts index e36d6501ec..717c5873d2 100644 --- a/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/paginated-drag-and-drop-bitstream-list/paginated-drag-and-drop-bitstream-list.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/paginated-drag-and-drop-bitstream-list/paginated-drag-and-drop-bitstream-list.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { Bundle } from '../../../../../core/shared/bundle.model'; import { TranslateModule } from '@ngx-translate/core'; @@ -66,7 +66,7 @@ describe('PaginatedDragAndDropBitstreamListComponent', () => { changeType: undefined }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { objectUpdatesService = jasmine.createSpyObj('objectUpdatesService', { getFieldUpdates: observableOf({ diff --git a/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.spec.ts b/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.spec.ts index bfcbba5c23..c61ce56a71 100644 --- a/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.spec.ts @@ -1,5 +1,5 @@ import { ItemEditBitstreamComponent } from './item-edit-bitstream.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ObjectUpdatesService } from '../../../../core/data/object-updates/object-updates.service'; import { of as observableOf } from 'rxjs'; import { Bitstream } from '../../../../core/shared/bitstream.model'; @@ -41,7 +41,7 @@ const url = 'thisUrl'; let objectUpdatesService: ObjectUpdatesService; describe('ItemEditBitstreamComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { objectUpdatesService = jasmine.createSpyObj('objectUpdatesService', { getFieldUpdates: observableOf({ diff --git a/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.spec.ts b/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.spec.ts index ed61cfc48c..0eba102414 100644 --- a/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.spec.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { EventEmitter } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; import { ActivatedRoute, Router } from '@angular/router'; @@ -100,7 +100,7 @@ describe('ItemCollectionMapperComponent', () => { onDefaultLangChange: new EventEmitter() }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [CommonModule, FormsModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], declarations: [ItemCollectionMapperComponent, CollectionSelectComponent, SearchFormComponent, PaginationComponent, EnumKeysPipe, VarDirective, ErrorComponent, LoadingComponent], diff --git a/src/app/+item-page/edit-item-page/item-delete/item-delete.component.spec.ts b/src/app/+item-page/edit-item-page/item-delete/item-delete.component.spec.ts index 53ae74a96c..ef78d11de5 100644 --- a/src/app/+item-page/edit-item-page/item-delete/item-delete.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-delete/item-delete.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ItemType } from '../../../core/shared/item-relationships/item-type.model'; import { Relationship } from '../../../core/shared/item-relationships/relationship.model'; import { Item } from '../../../core/shared/item.model'; @@ -16,10 +16,7 @@ import { NotificationsService } from '../../../shared/notifications/notification import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { ItemDeleteComponent } from './item-delete.component'; -import { - createSuccessfulRemoteDataObject, - createSuccessfulRemoteDataObject$ -} from '../../../shared/remote-data.utils'; +import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils'; import { VarDirective } from '../../../shared/utils/var.directive'; import { ObjectUpdatesService } from '../../../core/data/object-updates/object-updates.service'; import { RelationshipService } from '../../../core/data/relationship.service'; @@ -48,7 +45,7 @@ let notificationsServiceStub; let typesSelection; describe('ItemDeleteComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { mockItem = Object.assign(new Item(), { id: 'fake-id', @@ -80,15 +77,15 @@ describe('ItemDeleteComponent', () => { id: '1', uuid: 'relationship-1', relationshipType: createSuccessfulRemoteDataObject$(type1), - leftItem: createSuccessfulRemoteDataObject$(mockItem), - rightItem: createSuccessfulRemoteDataObject$(new Item()), + leftItem: createSuccessfulRemoteDataObject$(mockItem), + rightItem: createSuccessfulRemoteDataObject$(new Item()), }), Object.assign(new Relationship(), { id: '2', uuid: 'relationship-2', relationshipType: createSuccessfulRemoteDataObject$(type2), - leftItem: createSuccessfulRemoteDataObject$(mockItem), - rightItem: createSuccessfulRemoteDataObject$(new Item()), + leftItem: createSuccessfulRemoteDataObject$(mockItem), + rightItem: createSuccessfulRemoteDataObject$(new Item()), }), ]; diff --git a/src/app/+item-page/edit-item-page/item-metadata/edit-in-place-field/edit-in-place-field.component.spec.ts b/src/app/+item-page/edit-item-page/item-metadata/edit-in-place-field/edit-in-place-field.component.spec.ts index fe020c9930..ac58ccc42c 100644 --- a/src/app/+item-page/edit-item-page/item-metadata/edit-in-place-field/edit-in-place-field.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-metadata/edit-in-place-field/edit-in-place-field.component.spec.ts @@ -1,5 +1,5 @@ import { CUSTOM_ELEMENTS_SCHEMA, DebugElement } from '@angular/core'; -import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; import { TranslateModule } from '@ngx-translate/core'; @@ -15,9 +15,7 @@ import { MetadataSchema } from '../../../../core/metadata/metadata-schema.model' import { RegistryService } from '../../../../core/registry/registry.service'; import { MetadatumViewModel } from '../../../../core/shared/metadata.models'; import { InputSuggestion } from '../../../../shared/input-suggestions/input-suggestions.model'; -import { - createSuccessfulRemoteDataObject$ -} from '../../../../shared/remote-data.utils'; +import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils'; import { followLink } from '../../../../shared/utils/follow-link-config.model'; import { EditInPlaceFieldComponent } from './edit-in-place-field.component'; import { MockComponent, MockDirective } from 'ng-mocks'; @@ -63,7 +61,7 @@ let scheduler: TestScheduler; describe('EditInPlaceFieldComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { scheduler = getTestScheduler(); paginatedMetadataFields = buildPaginatedList(undefined, [mdField1, mdField2, mdField3]); @@ -209,9 +207,18 @@ describe('EditInPlaceFieldComponent', () => { const metadataFieldSuggestions: InputSuggestion[] = [ - { displayValue: ('dc.' + mdField1.toString()).split('.').join('.​'), value: ('dc.' + mdField1.toString()) }, - { displayValue: ('dc.' + mdField2.toString()).split('.').join('.​'), value: ('dc.' + mdField2.toString()) }, - { displayValue: ('dc.' + mdField3.toString()).split('.').join('.​'), value: ('dc.' + mdField3.toString()) } + { + displayValue: ('dc.' + mdField1.toString()).split('.').join('.​'), + value: ('dc.' + mdField1.toString()) + }, + { + displayValue: ('dc.' + mdField2.toString()).split('.').join('.​'), + value: ('dc.' + mdField2.toString()) + }, + { + displayValue: ('dc.' + mdField3.toString()).split('.').join('.​'), + value: ('dc.' + mdField3.toString()) + } ]; beforeEach(fakeAsync(() => { diff --git a/src/app/+item-page/edit-item-page/item-metadata/item-metadata.component.spec.ts b/src/app/+item-page/edit-item-page/item-metadata/item-metadata.component.spec.ts index 62c1aa70d1..8b810239b7 100644 --- a/src/app/+item-page/edit-item-page/item-metadata/item-metadata.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-metadata/item-metadata.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; import { of as observableOf } from 'rxjs'; import { getTestScheduler } from 'jasmine-marbles'; @@ -11,10 +11,7 @@ import { NotificationsService } from '../../../shared/notifications/notification import { TranslateModule } from '@ngx-translate/core'; import { ItemDataService } from '../../../core/data/item-data.service'; import { By } from '@angular/platform-browser'; -import { - INotification, - Notification -} from '../../../shared/notifications/models/notification.model'; +import { INotification, Notification } from '../../../shared/notifications/models/notification.model'; import { NotificationType } from '../../../shared/notifications/models/notification-type'; import { RouterStub } from '../../../shared/testing/router.stub'; import { Item } from '../../../core/shared/item.model'; @@ -23,10 +20,7 @@ import { MetadatumViewModel } from '../../../core/shared/metadata.models'; import { RegistryService } from '../../../core/registry/registry.service'; import { MetadataSchema } from '../../../core/metadata/metadata-schema.model'; import { MetadataField } from '../../../core/metadata/metadata-field.model'; -import { - createSuccessfulRemoteDataObject, - createSuccessfulRemoteDataObject$ -} from '../../../shared/remote-data.utils'; +import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils'; import { ObjectCacheService } from '../../../core/cache/object-cache.service'; import { DSOSuccessResponse } from '../../../core/cache/response.models'; import { createPaginatedList } from '../../../shared/testing/utils.test'; @@ -108,7 +102,7 @@ const operation1 = { op: 'remove', path: '/metadata/dc.title/1' }; let scheduler: TestScheduler; let item; describe('ItemMetadataComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { item = Object.assign(new Item(), { metadata: { [metadatum1.key]: [metadatum1], @@ -227,7 +221,7 @@ describe('ItemMetadataComponent', () => { it('it should call reinstateFieldUpdates on the objectUpdatesService with the correct url and metadata', () => { expect(objectUpdatesService.createPatch).toHaveBeenCalledWith(url); - expect(itemService.patch).toHaveBeenCalledWith(comp.item, [ operation1 ]); + expect(itemService.patch).toHaveBeenCalledWith(comp.item, [operation1]); expect(objectUpdatesService.getFieldUpdates).toHaveBeenCalledWith(url, comp.item.metadataAsList); }); }); diff --git a/src/app/+item-page/edit-item-page/item-operation/item-operation.component.spec.ts b/src/app/+item-page/edit-item-page/item-operation/item-operation.component.spec.ts index 7122dbaf42..00e7f8452a 100644 --- a/src/app/+item-page/edit-item-page/item-operation/item-operation.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-operation/item-operation.component.spec.ts @@ -1,5 +1,5 @@ import { ItemOperation } from './itemOperation.model'; -import { async, TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { ItemOperationComponent } from './item-operation.component'; import { TranslateModule } from '@ngx-translate/core'; import { By } from '@angular/platform-browser'; @@ -11,7 +11,7 @@ describe('ItemOperationComponent', () => { let fixture; let comp; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([])], declarations: [ItemOperationComponent] @@ -19,7 +19,7 @@ describe('ItemOperationComponent', () => { })); beforeEach(() => { - itemOperation = new ItemOperation('key1', 'url1'); + itemOperation = new ItemOperation('key1', 'url1'); fixture = TestBed.createComponent(ItemOperationComponent); comp = fixture.componentInstance; diff --git a/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.spec.ts b/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.spec.ts index 6a2168999d..8e08b333ce 100644 --- a/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.spec.ts @@ -14,10 +14,7 @@ import { NotificationsService } from '../../../shared/notifications/notification import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { ItemReinstateComponent } from './item-reinstate.component'; -import { - createSuccessfulRemoteDataObject, - createSuccessfulRemoteDataObject$ -} from '../../../shared/remote-data.utils'; +import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils'; let comp: ItemReinstateComponent; let fixture: ComponentFixture; diff --git a/src/app/+item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.spec.ts b/src/app/+item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.spec.ts index 61e66ddc77..90fad00a45 100644 --- a/src/app/+item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.spec.ts @@ -1,5 +1,5 @@ import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { TranslateModule } from '@ngx-translate/core'; import { of as observableOf } from 'rxjs'; @@ -40,7 +40,7 @@ let relationshipType; describe('EditRelationshipListComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { entityType = Object.assign(new ItemType(), { id: 'Publication', diff --git a/src/app/+item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.spec.ts b/src/app/+item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.spec.ts index 70e6e6b472..3ab17ad623 100644 --- a/src/app/+item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.spec.ts @@ -1,5 +1,5 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { of as observableOf } from 'rxjs'; import { FieldChangeType } from '../../../../core/data/object-updates/object-updates.actions'; @@ -31,7 +31,7 @@ let el; describe('EditRelationshipComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { relationshipType = Object.assign(new RelationshipType(), { id: '1', @@ -121,12 +121,13 @@ describe('EditRelationshipComponent', () => { declarations: [EditRelationshipComponent], providers: [ { provide: ObjectUpdatesService, useValue: objectUpdatesService }, - { provide: NgbModal, useValue: { + { + provide: NgbModal, useValue: { open: () => {/*comment*/ } }, }, - ], schemas: [ + ], schemas: [ NO_ERRORS_SCHEMA ] }).compileComponents(); diff --git a/src/app/+item-page/edit-item-page/item-relationships/item-relationships.component.spec.ts b/src/app/+item-page/edit-item-page/item-relationships/item-relationships.component.spec.ts index 444696447b..f3871ea98b 100644 --- a/src/app/+item-page/edit-item-page/item-relationships/item-relationships.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-relationships/item-relationships.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectorRef, DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; import { getTestScheduler } from 'jasmine-marbles'; @@ -63,7 +63,7 @@ let relationships; let relationshipType; describe('ItemRelationshipsComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { const date = new Date(); relationshipType = Object.assign(new RelationshipType(), { diff --git a/src/app/+item-page/edit-item-page/item-status/item-status.component.spec.ts b/src/app/+item-page/edit-item-page/item-status/item-status.component.spec.ts index f9053df767..63d15d62d8 100644 --- a/src/app/+item-page/edit-item-page/item-status/item-status.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-status/item-status.component.spec.ts @@ -1,5 +1,5 @@ import { ItemStatusComponent } from './item-status.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { CommonModule } from '@angular/common'; @@ -30,14 +30,14 @@ describe('ItemStatusComponent', () => { const itemPageUrl = `items/${mockItem.id}`; const routeStub = { - parent: { - data: observableOf({ dso: createSuccessfulRemoteDataObject(mockItem) }) - } - }; + parent: { + data: observableOf({ dso: createSuccessfulRemoteDataObject(mockItem) }) + } + }; let authorizationService: AuthorizationDataService; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { authorizationService = jasmine.createSpyObj('authorizationService', { isAuthorized: observableOf(true) }); diff --git a/src/app/+item-page/edit-item-page/item-version-history/item-version-history.component.spec.ts b/src/app/+item-page/edit-item-page/item-version-history/item-version-history.component.spec.ts index 4d5de65428..c68dcfeba3 100644 --- a/src/app/+item-page/edit-item-page/item-version-history/item-version-history.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-version-history/item-version-history.component.spec.ts @@ -1,5 +1,5 @@ import { ItemVersionHistoryComponent } from './item-version-history.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { VarDirective } from '../../../shared/utils/var.directive'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; @@ -18,7 +18,7 @@ describe('ItemVersionHistoryComponent', () => { handle: '123456789/1', }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ItemVersionHistoryComponent, VarDirective], imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([])], diff --git a/src/app/+item-page/edit-item-page/modify-item-overview/modify-item-overview.component.spec.ts b/src/app/+item-page/edit-item-page/modify-item-overview/modify-item-overview.component.spec.ts index 07ad9a347c..748231be1c 100644 --- a/src/app/+item-page/edit-item-page/modify-item-overview/modify-item-overview.component.spec.ts +++ b/src/app/+item-page/edit-item-page/modify-item-overview/modify-item-overview.component.spec.ts @@ -1,5 +1,5 @@ import {Item} from '../../../core/shared/item.model'; -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; +import {waitForAsync, ComponentFixture, TestBed} from '@angular/core/testing'; import {ModifyItemOverviewComponent} from './modify-item-overview.component'; import {By} from '@angular/platform-browser'; import {TranslateModule} from '@ngx-translate/core'; @@ -22,7 +22,7 @@ const mockItem = Object.assign(new Item(), { }); describe('ModifyItemOverviewComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], declarations: [ModifyItemOverviewComponent], diff --git a/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.ts b/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.ts index f9bc44acec..78ef2def9e 100644 --- a/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.ts +++ b/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { Item } from '../../../core/shared/item.model'; import { RouterStub } from '../../../shared/testing/router.stub'; import { CommonModule } from '@angular/common'; @@ -54,7 +54,7 @@ let successfulRemoteData; let failedRemoteData; describe('AbstractSimpleItemActionComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { mockItem = Object.assign(new Item(), { id: 'fake-id', diff --git a/src/app/+item-page/edit-item-page/virtual-metadata/virtual-metadata.component.spec.ts b/src/app/+item-page/edit-item-page/virtual-metadata/virtual-metadata.component.spec.ts index 956be4e141..8fb1b1c483 100644 --- a/src/app/+item-page/edit-item-page/virtual-metadata/virtual-metadata.component.spec.ts +++ b/src/app/+item-page/edit-item-page/virtual-metadata/virtual-metadata.component.spec.ts @@ -45,7 +45,7 @@ describe('VirtualMetadataComponent', () => { imports: [TranslateModule.forRoot()], declarations: [VirtualMetadataComponent, VarDirective], providers: [ - {provide: ObjectUpdatesService, useValue: objectUpdatesService}, + { provide: ObjectUpdatesService, useValue: objectUpdatesService }, ], schemas: [ NO_ERRORS_SCHEMA ] diff --git a/src/app/+item-page/field-components/collections/collections.component.spec.ts b/src/app/+item-page/field-components/collections/collections.component.spec.ts index 1ff9e497e8..70ce5db760 100644 --- a/src/app/+item-page/field-components/collections/collections.component.spec.ts +++ b/src/app/+item-page/field-components/collections/collections.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { TranslateModule } from '@ngx-translate/core'; import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service'; @@ -7,10 +7,7 @@ import { CollectionDataService } from '../../../core/data/collection-data.servic import { Collection } from '../../../core/shared/collection.model'; import { Item } from '../../../core/shared/item.model'; import { getMockRemoteDataBuildService } from '../../../shared/mocks/remote-data-build.service.mock'; -import { - createFailedRemoteDataObject$, - createSuccessfulRemoteDataObject$ -} from '../../../shared/remote-data.utils'; +import { createFailedRemoteDataObject$, createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils'; import { CollectionsComponent } from './collections.component'; let collectionsComponent: CollectionsComponent; @@ -45,7 +42,7 @@ describe('CollectionsComponent', () => { } } }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], declarations: [ CollectionsComponent ], @@ -60,7 +57,7 @@ describe('CollectionsComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(CollectionsComponent); collectionsComponent = fixture.componentInstance; collectionsComponent.label = 'test.test'; diff --git a/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.spec.ts b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.spec.ts index d7e1b80c76..9c62b80cad 100644 --- a/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.spec.ts +++ b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.spec.ts @@ -1,5 +1,5 @@ import { Component } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { MetadataFieldWrapperComponent } from './metadata-field-wrapper.component'; @@ -41,7 +41,7 @@ describe('MetadataFieldWrapperComponent', () => { let component: MetadataFieldWrapperComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [MetadataFieldWrapperComponent, NoContentComponent, SpanContentComponent, TextContentComponent, ImgContentComponent] }).compileComponents(); diff --git a/src/app/+item-page/field-components/metadata-uri-values/metadata-uri-values.component.spec.ts b/src/app/+item-page/field-components/metadata-uri-values/metadata-uri-values.component.spec.ts index 5f9a87a948..c35256e9aa 100644 --- a/src/app/+item-page/field-components/metadata-uri-values/metadata-uri-values.component.spec.ts +++ b/src/app/+item-page/field-components/metadata-uri-values/metadata-uri-values.component.spec.ts @@ -1,6 +1,6 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { ChangeDetectionStrategy, DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { TranslateLoaderMock } from '../../../shared/mocks/translate-loader.mock'; import { By } from '@angular/platform-browser'; import { MetadataUriValuesComponent } from './metadata-uri-values.component'; @@ -25,7 +25,7 @@ const mockLabel = 'fake.message'; const mockLinkText = 'fake link text'; describe('MetadataUriValuesComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot({ loader: { @@ -40,7 +40,7 @@ describe('MetadataUriValuesComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(MetadataUriValuesComponent); comp = fixture.componentInstance; comp.mdValues = mockMetadata; diff --git a/src/app/+item-page/field-components/metadata-values/metadata-values.component.spec.ts b/src/app/+item-page/field-components/metadata-values/metadata-values.component.spec.ts index 05bc0f8a93..bd606ad5a0 100644 --- a/src/app/+item-page/field-components/metadata-values/metadata-values.component.spec.ts +++ b/src/app/+item-page/field-components/metadata-values/metadata-values.component.spec.ts @@ -1,6 +1,6 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { TranslateLoaderMock } from '../../../shared/mocks/translate-loader.mock'; import { MetadataValuesComponent } from './metadata-values.component'; import { By } from '@angular/platform-browser'; @@ -26,7 +26,7 @@ const mockSeperator = '
'; const mockLabel = 'fake.message'; describe('MetadataValuesComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot({ loader: { @@ -41,7 +41,7 @@ describe('MetadataValuesComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(MetadataValuesComponent); comp = fixture.componentInstance; comp.mdValues = mockMetadata; diff --git a/src/app/+item-page/full/field-components/file-section/full-file-section.component.spec.ts b/src/app/+item-page/full/field-components/file-section/full-file-section.component.spec.ts index 97f52c7e1e..1773a0fe74 100644 --- a/src/app/+item-page/full/field-components/file-section/full-file-section.component.spec.ts +++ b/src/app/+item-page/full/field-components/file-section/full-file-section.component.spec.ts @@ -1,120 +1,120 @@ -import {FullFileSectionComponent} from './full-file-section.component'; -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import {createSuccessfulRemoteDataObject$} from '../../../../shared/remote-data.utils'; -import {createPaginatedList} from '../../../../shared/testing/utils.test'; -import {TranslateLoader, TranslateModule} from '@ngx-translate/core'; -import {TranslateLoaderMock} from '../../../../shared/mocks/translate-loader.mock'; -import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; -import {VarDirective} from '../../../../shared/utils/var.directive'; -import {FileSizePipe} from '../../../../shared/utils/file-size-pipe'; -import {MetadataFieldWrapperComponent} from '../../../field-components/metadata-field-wrapper/metadata-field-wrapper.component'; -import {BitstreamDataService} from '../../../../core/data/bitstream-data.service'; -import {NO_ERRORS_SCHEMA} from '@angular/core'; -import {Bitstream} from '../../../../core/shared/bitstream.model'; -import {of as observableOf} from 'rxjs'; -import {MockBitstreamFormat1} from '../../../../shared/mocks/item.mock'; -import {By} from '@angular/platform-browser'; +import { FullFileSectionComponent } from './full-file-section.component'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils'; +import { createPaginatedList } from '../../../../shared/testing/utils.test'; +import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; +import { TranslateLoaderMock } from '../../../../shared/mocks/translate-loader.mock'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { VarDirective } from '../../../../shared/utils/var.directive'; +import { FileSizePipe } from '../../../../shared/utils/file-size-pipe'; +import { MetadataFieldWrapperComponent } from '../../../field-components/metadata-field-wrapper/metadata-field-wrapper.component'; +import { BitstreamDataService } from '../../../../core/data/bitstream-data.service'; +import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { Bitstream } from '../../../../core/shared/bitstream.model'; +import { of as observableOf } from 'rxjs'; +import { MockBitstreamFormat1 } from '../../../../shared/mocks/item.mock'; +import { By } from '@angular/platform-browser'; import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub'; describe('FullFileSectionComponent', () => { - let comp: FullFileSectionComponent; - let fixture: ComponentFixture; + let comp: FullFileSectionComponent; + let fixture: ComponentFixture; - const mockBitstream: Bitstream = Object.assign(new Bitstream(), - { - sizeBytes: 10201, - content: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713/content', - format: observableOf(MockBitstreamFormat1), - bundleName: 'ORIGINAL', - _links: { - self: { - href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713' - }, - content: { - href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713/content' - } - }, - id: 'cf9b0c8e-a1eb-4b65-afd0-567366448713', - uuid: 'cf9b0c8e-a1eb-4b65-afd0-567366448713', - type: 'bitstream', - metadata: { - 'dc.title': [ - { - language: null, - value: 'test_word.docx' - } - ] - } - }); - - const bitstreamDataService = jasmine.createSpyObj('bitstreamDataService', { - findAllByItemAndBundleName: createSuccessfulRemoteDataObject$(createPaginatedList([mockBitstream, mockBitstream, mockBitstream])) + const mockBitstream: Bitstream = Object.assign(new Bitstream(), + { + sizeBytes: 10201, + content: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713/content', + format: observableOf(MockBitstreamFormat1), + bundleName: 'ORIGINAL', + _links: { + self: { + href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713' + }, + content: { + href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713/content' + } + }, + id: 'cf9b0c8e-a1eb-4b65-afd0-567366448713', + uuid: 'cf9b0c8e-a1eb-4b65-afd0-567366448713', + type: 'bitstream', + metadata: { + 'dc.title': [ + { + language: null, + value: 'test_word.docx' + } + ] + } }); - beforeEach(async(() => { + const bitstreamDataService = jasmine.createSpyObj('bitstreamDataService', { + findAllByItemAndBundleName: createSuccessfulRemoteDataObject$(createPaginatedList([mockBitstream, mockBitstream, mockBitstream])) + }); - TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot({ - loader: { - provide: TranslateLoader, - useClass: TranslateLoaderMock - } - }), BrowserAnimationsModule], - declarations: [FullFileSectionComponent, VarDirective, FileSizePipe, MetadataFieldWrapperComponent], - providers: [ - {provide: BitstreamDataService, useValue: bitstreamDataService}, - {provide: NotificationsService, useValue: new NotificationsServiceStub()} - ], + beforeEach(waitForAsync(() => { - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); - })); + TestBed.configureTestingModule({ + imports: [TranslateModule.forRoot({ + loader: { + provide: TranslateLoader, + useClass: TranslateLoaderMock + } + }), BrowserAnimationsModule], + declarations: [FullFileSectionComponent, VarDirective, FileSizePipe, MetadataFieldWrapperComponent], + providers: [ + { provide: BitstreamDataService, useValue: bitstreamDataService }, + { provide: NotificationsService, useValue: new NotificationsServiceStub() } + ], - beforeEach(async(() => { - fixture = TestBed.createComponent(FullFileSectionComponent); - comp = fixture.componentInstance; + schemas: [NO_ERRORS_SCHEMA] + }).compileComponents(); + })); + + beforeEach(waitForAsync(() => { + fixture = TestBed.createComponent(FullFileSectionComponent); + comp = fixture.componentInstance; + fixture.detectChanges(); + })); + + describe('when the full file section gets loaded with bitstreams available', () => { + it('should contain a list with bitstreams', () => { + const fileSection = fixture.debugElement.queryAll(By.css('.file-section')); + expect(fileSection.length).toEqual(6); + }); + + describe('when we press the pageChange button for original bundle', () => { + beforeEach(() => { + comp.switchOriginalPage(2); fixture.detectChanges(); - })); + }); - describe('when the full file section gets loaded with bitstreams available', () => { - it ('should contain a list with bitstreams', () => { - const fileSection = fixture.debugElement.queryAll(By.css('.file-section')); - expect(fileSection.length).toEqual(6); - }); - - describe('when we press the pageChange button for original bundle', () => { - beforeEach(() => { - comp.switchOriginalPage(2); - fixture.detectChanges(); - }); - - it ('should give the value to the currentpage', () => { - expect(comp.originalOptions.currentPage).toBe(2); - }); - it ('should call the next function on the originalCurrentPage', (done) => { - comp.originalCurrentPage$.subscribe((event) => { - expect(event).toEqual(2); - done(); - }); - }); - }); - - describe('when we press the pageChange button for license bundle', () => { - beforeEach(() => { - comp.switchLicensePage(2); - fixture.detectChanges(); - }); - - it ('should give the value to the currentpage', () => { - expect(comp.licenseOptions.currentPage).toBe(2); - }); - it ('should call the next function on the licenseCurrentPage', (done) => { - comp.licenseCurrentPage$.subscribe((event) => { - expect(event).toEqual(2); - done(); - }); - }); + it('should give the value to the currentpage', () => { + expect(comp.originalOptions.currentPage).toBe(2); + }); + it('should call the next function on the originalCurrentPage', (done) => { + comp.originalCurrentPage$.subscribe((event) => { + expect(event).toEqual(2); + done(); }); + }); }); + + describe('when we press the pageChange button for license bundle', () => { + beforeEach(() => { + comp.switchLicensePage(2); + fixture.detectChanges(); + }); + + it('should give the value to the currentpage', () => { + expect(comp.licenseOptions.currentPage).toBe(2); + }); + it('should call the next function on the licenseCurrentPage', (done) => { + comp.licenseCurrentPage$.subscribe((event) => { + expect(event).toEqual(2); + done(); + }); + }); + }); + }); }); diff --git a/src/app/+item-page/full/full-item-page.component.spec.ts b/src/app/+item-page/full/full-item-page.component.spec.ts index 96f9ad519b..b4b9e77ed5 100644 --- a/src/app/+item-page/full/full-item-page.component.spec.ts +++ b/src/app/+item-page/full/full-item-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ItemDataService } from '../../core/data/item-data.service'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { TranslateLoaderMock } from '../../shared/mocks/translate-loader.mock'; @@ -14,30 +14,28 @@ import { Item } from '../../core/shared/item.model'; import { of as observableOf } from 'rxjs'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { By } from '@angular/platform-browser'; -import { - createSuccessfulRemoteDataObject, - createSuccessfulRemoteDataObject$ -} from '../../shared/remote-data.utils'; +import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils'; import { AuthService } from '../../core/auth/auth.service'; import { createPaginatedList } from '../../shared/testing/utils.test'; const mockItem: Item = Object.assign(new Item(), { bundles: createSuccessfulRemoteDataObject$(createPaginatedList([])), metadata: { - 'dc.title': [ - { - language: 'en_US', - value: 'test item' - } - ] - } + 'dc.title': [ + { + language: 'en_US', + value: 'test item' + } + ] + } }); const routeStub = Object.assign(new ActivatedRouteStub(), { data: observableOf({ dso: createSuccessfulRemoteDataObject(mockItem) }) }); const metadataServiceStub = { /* tslint:disable:no-empty */ - processRemoteData: () => {} + processRemoteData: () => { + } /* tslint:enable:no-empty */ }; @@ -47,7 +45,7 @@ describe('FullItemPageComponent', () => { let authService: AuthService; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { authService = jasmine.createSpyObj('authService', { isAuthenticated: observableOf(true), setRedirectUrl: {} @@ -62,19 +60,19 @@ describe('FullItemPageComponent', () => { }), RouterTestingModule.withRoutes([]), BrowserAnimationsModule], declarations: [FullItemPageComponent, TruncatePipe, VarDirective], providers: [ - {provide: ActivatedRoute, useValue: routeStub}, - {provide: ItemDataService, useValue: {}}, - {provide: MetadataService, useValue: metadataServiceStub}, + { provide: ActivatedRoute, useValue: routeStub }, + { provide: ItemDataService, useValue: {} }, + { provide: MetadataService, useValue: metadataServiceStub }, { provide: AuthService, useValue: authService }, ], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(FullItemPageComponent, { - set: {changeDetection: ChangeDetectionStrategy.Default} + set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(FullItemPageComponent); comp = fixture.componentInstance; fixture.detectChanges(); diff --git a/src/app/+item-page/simple/field-components/file-section/file-section.component.spec.ts b/src/app/+item-page/simple/field-components/file-section/file-section.component.spec.ts index 4a0ca6085e..fdd6d14e7d 100644 --- a/src/app/+item-page/simple/field-components/file-section/file-section.component.spec.ts +++ b/src/app/+item-page/simple/field-components/file-section/file-section.component.spec.ts @@ -1,172 +1,172 @@ -import {FileSectionComponent} from './file-section.component'; -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import {TranslateLoader, TranslateModule} from '@ngx-translate/core'; -import {TranslateLoaderMock} from '../../../../shared/mocks/translate-loader.mock'; -import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; -import {VarDirective} from '../../../../shared/utils/var.directive'; -import {NO_ERRORS_SCHEMA} from '@angular/core'; -import {BitstreamDataService} from '../../../../core/data/bitstream-data.service'; -import {createSuccessfulRemoteDataObject$} from '../../../../shared/remote-data.utils'; -import {By} from '@angular/platform-browser'; -import {Bitstream} from '../../../../core/shared/bitstream.model'; -import {of as observableOf} from 'rxjs'; -import {MockBitstreamFormat1} from '../../../../shared/mocks/item.mock'; -import {FileSizePipe} from '../../../../shared/utils/file-size-pipe'; -import {PageInfo} from '../../../../core/shared/page-info.model'; -import {MetadataFieldWrapperComponent} from '../../../field-components/metadata-field-wrapper/metadata-field-wrapper.component'; -import {createPaginatedList} from '../../../../shared/testing/utils.test'; +import { FileSectionComponent } from './file-section.component'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; +import { TranslateLoaderMock } from '../../../../shared/mocks/translate-loader.mock'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { VarDirective } from '../../../../shared/utils/var.directive'; +import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { BitstreamDataService } from '../../../../core/data/bitstream-data.service'; +import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils'; +import { By } from '@angular/platform-browser'; +import { Bitstream } from '../../../../core/shared/bitstream.model'; +import { of as observableOf } from 'rxjs'; +import { MockBitstreamFormat1 } from '../../../../shared/mocks/item.mock'; +import { FileSizePipe } from '../../../../shared/utils/file-size-pipe'; +import { PageInfo } from '../../../../core/shared/page-info.model'; +import { MetadataFieldWrapperComponent } from '../../../field-components/metadata-field-wrapper/metadata-field-wrapper.component'; +import { createPaginatedList } from '../../../../shared/testing/utils.test'; import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub'; describe('FileSectionComponent', () => { - let comp: FileSectionComponent; - let fixture: ComponentFixture; + let comp: FileSectionComponent; + let fixture: ComponentFixture; - const bitstreamDataService = jasmine.createSpyObj('bitstreamDataService', { - findAllByItemAndBundleName: createSuccessfulRemoteDataObject$(createPaginatedList([])) + const bitstreamDataService = jasmine.createSpyObj('bitstreamDataService', { + findAllByItemAndBundleName: createSuccessfulRemoteDataObject$(createPaginatedList([])) + }); + + const mockBitstream: Bitstream = Object.assign(new Bitstream(), + { + sizeBytes: 10201, + content: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713/content', + format: observableOf(MockBitstreamFormat1), + bundleName: 'ORIGINAL', + _links: { + self: { + href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713' + }, + content: { + href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713/content' + } + }, + id: 'cf9b0c8e-a1eb-4b65-afd0-567366448713', + uuid: 'cf9b0c8e-a1eb-4b65-afd0-567366448713', + type: 'bitstream', + metadata: { + 'dc.title': [ + { + language: null, + value: 'test_word.docx' + } + ] + } }); - const mockBitstream: Bitstream = Object.assign(new Bitstream(), - { - sizeBytes: 10201, - content: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713/content', - format: observableOf(MockBitstreamFormat1), - bundleName: 'ORIGINAL', - _links: { - self: { - href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713' - }, - content: { - href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713/content' - } - }, - id: 'cf9b0c8e-a1eb-4b65-afd0-567366448713', - uuid: 'cf9b0c8e-a1eb-4b65-afd0-567366448713', - type: 'bitstream', - metadata: { - 'dc.title': [ - { - language: null, - value: 'test_word.docx' - } - ] - } - }); + beforeEach(waitForAsync(() => { - beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [TranslateModule.forRoot({ + loader: { + provide: TranslateLoader, + useClass: TranslateLoaderMock + } + }), BrowserAnimationsModule], + declarations: [FileSectionComponent, VarDirective, FileSizePipe, MetadataFieldWrapperComponent], + providers: [ + { provide: BitstreamDataService, useValue: bitstreamDataService }, + { provide: NotificationsService, useValue: new NotificationsServiceStub() } + ], - TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot({ - loader: { - provide: TranslateLoader, - useClass: TranslateLoaderMock - } - }), BrowserAnimationsModule], - declarations: [FileSectionComponent, VarDirective, FileSizePipe, MetadataFieldWrapperComponent], - providers: [ - {provide: BitstreamDataService, useValue: bitstreamDataService}, - {provide: NotificationsService, useValue: new NotificationsServiceStub()} - ], + schemas: [NO_ERRORS_SCHEMA] + }).compileComponents(); + })); - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); - })); + beforeEach(waitForAsync(() => { + fixture = TestBed.createComponent(FileSectionComponent); + comp = fixture.componentInstance; + fixture.detectChanges(); + })); - beforeEach(async(() => { - fixture = TestBed.createComponent(FileSectionComponent); - comp = fixture.componentInstance; + describe('when the bitstreams are loading', () => { + beforeEach(() => { + comp.bitstreams$.next([mockBitstream]); + comp.isLoading = true; + fixture.detectChanges(); + }); + + it('should display a loading component', () => { + const loading = fixture.debugElement.query(By.css('ds-loading')); + expect(loading.nativeElement).toBeDefined(); + }); + }); + + describe('when the "Show more" button is clicked', () => { + + beforeEach(() => { + comp.bitstreams$.next([mockBitstream]); + comp.currentPage = 1; + comp.isLastPage = false; + fixture.detectChanges(); + }); + + it('should call the service to retrieve more bitstreams', () => { + const viewMore = fixture.debugElement.query(By.css('.bitstream-view-more')); + viewMore.triggerEventHandler('click', null); + expect(bitstreamDataService.findAllByItemAndBundleName).toHaveBeenCalled(); + }); + + it('one bitstream should be on the page', () => { + const viewMore = fixture.debugElement.query(By.css('.bitstream-view-more')); + viewMore.triggerEventHandler('click', null); + const fileDownloadLink = fixture.debugElement.queryAll(By.css('ds-file-download-link')); + expect(fileDownloadLink.length).toEqual(1); + }); + + describe('when it is then clicked again', () => { + beforeEach(() => { + bitstreamDataService.findAllByItemAndBundleName.and.returnValue(createSuccessfulRemoteDataObject$(createPaginatedList([mockBitstream]))); + const viewMore = fixture.debugElement.query(By.css('.bitstream-view-more')); + viewMore.triggerEventHandler('click', null); fixture.detectChanges(); - })); - describe('when the bitstreams are loading', () => { - beforeEach(() => { - comp.bitstreams$.next([mockBitstream]); - comp.isLoading = true; - fixture.detectChanges(); - }); + }); + it('should contain another bitstream', () => { + const fileDownloadLink = fixture.debugElement.queryAll(By.css('ds-file-download-link')); + expect(fileDownloadLink.length).toEqual(2); + }); + }); + }); - it('should display a loading component', () => { - const loading = fixture.debugElement.query(By.css('ds-loading')); - expect(loading.nativeElement).toBeDefined(); - }); + describe('when its the last page of bitstreams', () => { + beforeEach(() => { + comp.bitstreams$.next([mockBitstream]); + comp.isLastPage = true; + comp.currentPage = 2; + fixture.detectChanges(); }); - describe('when the "Show more" button is clicked', () => { - - beforeEach(() => { - comp.bitstreams$.next([mockBitstream]); - comp.currentPage = 1; - comp.isLastPage = false; - fixture.detectChanges(); - }); - - it('should call the service to retrieve more bitstreams', () => { - const viewMore = fixture.debugElement.query(By.css('.bitstream-view-more')); - viewMore.triggerEventHandler('click', null); - expect(bitstreamDataService.findAllByItemAndBundleName).toHaveBeenCalled(); - }); - - it('one bitstream should be on the page', () => { - const viewMore = fixture.debugElement.query(By.css('.bitstream-view-more')); - viewMore.triggerEventHandler('click', null); - const fileDownloadLink = fixture.debugElement.queryAll(By.css('ds-file-download-link')); - expect(fileDownloadLink.length).toEqual(1); - }); - - describe('when it is then clicked again', () => { - beforeEach(() => { - bitstreamDataService.findAllByItemAndBundleName.and.returnValue(createSuccessfulRemoteDataObject$(createPaginatedList([mockBitstream]))); - const viewMore = fixture.debugElement.query(By.css('.bitstream-view-more')); - viewMore.triggerEventHandler('click', null); - fixture.detectChanges(); - - }); - it('should contain another bitstream', () => { - const fileDownloadLink = fixture.debugElement.queryAll(By.css('ds-file-download-link')); - expect(fileDownloadLink.length).toEqual(2); - }); - }); + it('should not contain a view more link', () => { + const viewMore = fixture.debugElement.query(By.css('.bitstream-view-more')); + expect(viewMore).toBeNull(); }); - describe('when its the last page of bitstreams', () => { - beforeEach(() => { - comp.bitstreams$.next([mockBitstream]); - comp.isLastPage = true; - comp.currentPage = 2; - fixture.detectChanges(); - }); - - it('should not contain a view more link', () => { - const viewMore = fixture.debugElement.query(By.css('.bitstream-view-more')); - expect(viewMore).toBeNull(); - }); - - it('should contain a view less link', () => { - const viewLess = fixture.debugElement.query(By.css('.bitstream-collapse')); - expect(viewLess).toBeDefined(); - }); - - it('clicking on the view less link should reset the pages and call getNextPage()', () => { - const pageInfo = Object.assign(new PageInfo(), { - elementsPerPage: 3, - totalElements: 5, - totalPages: 2, - currentPage: 1, - _links: { - self: {href: 'https://rest.api/core/bitstreams/'}, - next: {href: 'https://rest.api/core/bitstreams?page=2'} - } - }); - const PaginatedList = Object.assign(createPaginatedList([mockBitstream]), { - pageInfo: pageInfo - }); - bitstreamDataService.findAllByItemAndBundleName.and.returnValue(createSuccessfulRemoteDataObject$(PaginatedList)); - const viewLess = fixture.debugElement.query(By.css('.bitstream-collapse')); - viewLess.triggerEventHandler('click', null); - expect(bitstreamDataService.findAllByItemAndBundleName).toHaveBeenCalled(); - expect(comp.currentPage).toBe(1); - expect(comp.isLastPage).toBeFalse(); - }); - + it('should contain a view less link', () => { + const viewLess = fixture.debugElement.query(By.css('.bitstream-collapse')); + expect(viewLess).toBeDefined(); }); + + it('clicking on the view less link should reset the pages and call getNextPage()', () => { + const pageInfo = Object.assign(new PageInfo(), { + elementsPerPage: 3, + totalElements: 5, + totalPages: 2, + currentPage: 1, + _links: { + self: { href: 'https://rest.api/core/bitstreams/' }, + next: { href: 'https://rest.api/core/bitstreams?page=2' } + } + }); + const PaginatedList = Object.assign(createPaginatedList([mockBitstream]), { + pageInfo: pageInfo + }); + bitstreamDataService.findAllByItemAndBundleName.and.returnValue(createSuccessfulRemoteDataObject$(PaginatedList)); + const viewLess = fixture.debugElement.query(By.css('.bitstream-collapse')); + viewLess.triggerEventHandler('click', null); + expect(bitstreamDataService.findAllByItemAndBundleName).toHaveBeenCalled(); + expect(comp.currentPage).toBe(1); + expect(comp.isLastPage).toBeFalse(); + }); + + }); }); diff --git a/src/app/+item-page/simple/field-components/specific-field/abstract/item-page-abstract-field.component.spec.ts b/src/app/+item-page/simple/field-components/specific-field/abstract/item-page-abstract-field.component.spec.ts index 6b2f3af9ff..3df1b58011 100644 --- a/src/app/+item-page/simple/field-components/specific-field/abstract/item-page-abstract-field.component.spec.ts +++ b/src/app/+item-page/simple/field-components/specific-field/abstract/item-page-abstract-field.component.spec.ts @@ -1,6 +1,6 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ItemPageAbstractFieldComponent } from './item-page-abstract-field.component'; import { TranslateLoaderMock } from '../../../../../shared/testing/translate-loader.mock'; import { MetadataValuesComponent } from '../../../../field-components/metadata-values/metadata-values.component'; @@ -13,7 +13,7 @@ const mockField = 'dc.description.abstract'; const mockValue = 'test value'; describe('ItemPageAbstractFieldComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot({ loader: { @@ -24,11 +24,11 @@ describe('ItemPageAbstractFieldComponent', () => { declarations: [ItemPageAbstractFieldComponent, MetadataValuesComponent], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(ItemPageAbstractFieldComponent, { - set: {changeDetection: ChangeDetectionStrategy.Default} + set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ItemPageAbstractFieldComponent); comp = fixture.componentInstance; comp.item = mockItemWithMetadataFieldAndValue(mockField, mockValue); diff --git a/src/app/+item-page/simple/field-components/specific-field/author/item-page-author-field.component.spec.ts b/src/app/+item-page/simple/field-components/specific-field/author/item-page-author-field.component.spec.ts index 7d5cb842a3..bbe70aa542 100644 --- a/src/app/+item-page/simple/field-components/specific-field/author/item-page-author-field.component.spec.ts +++ b/src/app/+item-page/simple/field-components/specific-field/author/item-page-author-field.component.spec.ts @@ -1,6 +1,6 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateLoaderMock } from '../../../../../shared/testing/translate-loader.mock'; import { MetadataValuesComponent } from '../../../../field-components/metadata-values/metadata-values.component'; import { mockItemWithMetadataFieldAndValue } from '../item-page-field.component.spec'; @@ -13,7 +13,7 @@ const mockFields = ['dc.contributor.author', 'dc.creator', 'dc.contributor']; const mockValue = 'test value'; describe('ItemPageAuthorFieldComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot({ loader: { @@ -24,12 +24,12 @@ describe('ItemPageAuthorFieldComponent', () => { declarations: [ItemPageAuthorFieldComponent, MetadataValuesComponent], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(ItemPageAuthorFieldComponent, { - set: {changeDetection: ChangeDetectionStrategy.Default} + set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); for (const field of mockFields) { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ItemPageAuthorFieldComponent); comp = fixture.componentInstance; comp.item = mockItemWithMetadataFieldAndValue(field, mockValue); diff --git a/src/app/+item-page/simple/field-components/specific-field/date/item-page-date-field.component.spec.ts b/src/app/+item-page/simple/field-components/specific-field/date/item-page-date-field.component.spec.ts index 842725be4c..d55c94a871 100644 --- a/src/app/+item-page/simple/field-components/specific-field/date/item-page-date-field.component.spec.ts +++ b/src/app/+item-page/simple/field-components/specific-field/date/item-page-date-field.component.spec.ts @@ -1,6 +1,6 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateLoaderMock } from '../../../../../shared/testing/translate-loader.mock'; import { MetadataValuesComponent } from '../../../../field-components/metadata-values/metadata-values.component'; import { mockItemWithMetadataFieldAndValue } from '../item-page-field.component.spec'; @@ -13,7 +13,7 @@ const mockField = 'dc.date.issued'; const mockValue = 'test value'; describe('ItemPageDateFieldComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot({ loader: { @@ -24,11 +24,11 @@ describe('ItemPageDateFieldComponent', () => { declarations: [ItemPageDateFieldComponent, MetadataValuesComponent], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(ItemPageDateFieldComponent, { - set: {changeDetection: ChangeDetectionStrategy.Default} + set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ItemPageDateFieldComponent); comp = fixture.componentInstance; comp.item = mockItemWithMetadataFieldAndValue(mockField, mockValue); diff --git a/src/app/+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component.spec.ts b/src/app/+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component.spec.ts index 2dabee2eab..fd380c1833 100644 --- a/src/app/+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component.spec.ts +++ b/src/app/+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component.spec.ts @@ -1,6 +1,6 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateLoaderMock } from '../../../../../shared/testing/translate-loader.mock'; import { MetadataValuesComponent } from '../../../../field-components/metadata-values/metadata-values.component'; import { mockItemWithMetadataFieldAndValue } from '../item-page-field.component.spec'; @@ -15,7 +15,7 @@ const mockLabel = 'test label'; const mockFields = [mockField]; describe('GenericItemPageFieldComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot({ loader: { @@ -26,11 +26,11 @@ describe('GenericItemPageFieldComponent', () => { declarations: [GenericItemPageFieldComponent, MetadataValuesComponent], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(GenericItemPageFieldComponent, { - set: {changeDetection: ChangeDetectionStrategy.Default} + set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(GenericItemPageFieldComponent); comp = fixture.componentInstance; comp.item = mockItemWithMetadataFieldAndValue(mockField, mockValue); diff --git a/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.spec.ts b/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.spec.ts index 637f9f9593..ba94be3e70 100644 --- a/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.spec.ts +++ b/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.spec.ts @@ -1,6 +1,6 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { Item } from '../../../../core/shared/item.model'; import { TranslateLoaderMock } from '../../../../shared/mocks/translate-loader.mock'; import { ItemPageFieldComponent } from './item-page-field.component'; @@ -18,7 +18,7 @@ const mockLabel = 'test label'; const mockFields = [mockField]; describe('ItemPageFieldComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot({ loader: { @@ -29,11 +29,11 @@ describe('ItemPageFieldComponent', () => { declarations: [ItemPageFieldComponent, MetadataValuesComponent], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(ItemPageFieldComponent, { - set: {changeDetection: ChangeDetectionStrategy.Default} + set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ItemPageFieldComponent); comp = fixture.componentInstance; comp.item = mockItemWithMetadataFieldAndValue(mockField, mockValue); diff --git a/src/app/+item-page/simple/field-components/specific-field/title/item-page-title-field.component.spec.ts b/src/app/+item-page/simple/field-components/specific-field/title/item-page-title-field.component.spec.ts index d5db9327a0..bc661e81c9 100644 --- a/src/app/+item-page/simple/field-components/specific-field/title/item-page-title-field.component.spec.ts +++ b/src/app/+item-page/simple/field-components/specific-field/title/item-page-title-field.component.spec.ts @@ -1,6 +1,6 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateLoaderMock } from '../../../../../shared/testing/translate-loader.mock'; import { MetadataValuesComponent } from '../../../../field-components/metadata-values/metadata-values.component'; import { mockItemWithMetadataFieldAndValue } from '../item-page-field.component.spec'; @@ -13,7 +13,7 @@ const mockField = 'dc.title'; const mockValue = 'test value'; describe('ItemPageTitleFieldComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot({ loader: { @@ -24,11 +24,11 @@ describe('ItemPageTitleFieldComponent', () => { declarations: [ItemPageTitleFieldComponent, MetadataValuesComponent], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(ItemPageTitleFieldComponent, { - set: {changeDetection: ChangeDetectionStrategy.Default} + set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ItemPageTitleFieldComponent); comp = fixture.componentInstance; comp.item = mockItemWithMetadataFieldAndValue(mockField, mockValue); diff --git a/src/app/+item-page/simple/field-components/specific-field/uri/item-page-uri-field.component.spec.ts b/src/app/+item-page/simple/field-components/specific-field/uri/item-page-uri-field.component.spec.ts index 0c246d5ded..2889dadcc7 100644 --- a/src/app/+item-page/simple/field-components/specific-field/uri/item-page-uri-field.component.spec.ts +++ b/src/app/+item-page/simple/field-components/specific-field/uri/item-page-uri-field.component.spec.ts @@ -1,6 +1,6 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateLoaderMock } from '../../../../../shared/testing/translate-loader.mock'; import { mockItemWithMetadataFieldAndValue } from '../item-page-field.component.spec'; import { ItemPageUriFieldComponent } from './item-page-uri-field.component'; @@ -14,7 +14,7 @@ const mockValue = 'test value'; const mockLabel = 'test label'; describe('ItemPageUriFieldComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot({ loader: { @@ -25,11 +25,11 @@ describe('ItemPageUriFieldComponent', () => { declarations: [ItemPageUriFieldComponent, MetadataUriValuesComponent], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(ItemPageUriFieldComponent, { - set: {changeDetection: ChangeDetectionStrategy.Default} + set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ItemPageUriFieldComponent); comp = fixture.componentInstance; comp.item = mockItemWithMetadataFieldAndValue(mockField, mockValue); diff --git a/src/app/+item-page/simple/item-page.component.spec.ts b/src/app/+item-page/simple/item-page.component.spec.ts index 837eec879a..ff5a1e38d5 100644 --- a/src/app/+item-page/simple/item-page.component.spec.ts +++ b/src/app/+item-page/simple/item-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { TranslateLoaderMock } from '../../shared/mocks/translate-loader.mock'; import { ItemDataService } from '../../core/data/item-data.service'; @@ -35,14 +35,15 @@ describe('ItemPageComponent', () => { const mockMetadataService = { /* tslint:disable:no-empty */ - processRemoteData: () => {} + processRemoteData: () => { + } /* tslint:enable:no-empty */ }; const mockRoute = Object.assign(new ActivatedRouteStub(), { data: observableOf({ dso: createSuccessfulRemoteDataObject(mockItem) }) }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { authService = jasmine.createSpyObj('authService', { isAuthenticated: observableOf(true), setRedirectUrl: {} @@ -57,20 +58,20 @@ describe('ItemPageComponent', () => { }), BrowserAnimationsModule], declarations: [ItemPageComponent, VarDirective], providers: [ - {provide: ActivatedRoute, useValue: mockRoute}, - {provide: ItemDataService, useValue: {}}, - {provide: MetadataService, useValue: mockMetadataService}, - {provide: Router, useValue: {}}, + { provide: ActivatedRoute, useValue: mockRoute }, + { provide: ItemDataService, useValue: {} }, + { provide: MetadataService, useValue: mockMetadataService }, + { provide: Router, useValue: {} }, { provide: AuthService, useValue: authService }, ], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(ItemPageComponent, { - set: {changeDetection: ChangeDetectionStrategy.Default} + set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ItemPageComponent); comp = fixture.componentInstance; fixture.detectChanges(); diff --git a/src/app/+item-page/simple/item-types/publication/publication.component.spec.ts b/src/app/+item-page/simple/item-types/publication/publication.component.spec.ts index a0cd51a54c..90de1cd00a 100644 --- a/src/app/+item-page/simple/item-types/publication/publication.component.spec.ts +++ b/src/app/+item-page/simple/item-types/publication/publication.component.spec.ts @@ -1,6 +1,6 @@ import { HttpClient } from '@angular/common/http'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { Store } from '@ngrx/store'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; @@ -39,7 +39,7 @@ describe('PublicationComponent', () => { let comp: PublicationComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { const mockBitstreamDataService = { getThumbnailFor(item: Item): Observable> { return createSuccessfulRemoteDataObject$(new Bitstream()); @@ -76,7 +76,7 @@ describe('PublicationComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(PublicationComponent); comp = fixture.componentInstance; comp.object = mockItem; diff --git a/src/app/+item-page/simple/item-types/shared/item.component.spec.ts b/src/app/+item-page/simple/item-types/shared/item.component.spec.ts index 07fa197f40..8e444d844b 100644 --- a/src/app/+item-page/simple/item-types/shared/item.component.spec.ts +++ b/src/app/+item-page/simple/item-types/shared/item.component.spec.ts @@ -1,6 +1,6 @@ import { HttpClient } from '@angular/common/http'; import { ChangeDetectionStrategy, DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { Store } from '@ngrx/store'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; @@ -43,7 +43,7 @@ export function getItemPageFieldsTest(mockItem: Item, component) { let comp: any; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { const mockBitstreamDataService = { getThumbnailFor(item: Item): Observable> { return createSuccessfulRemoteDataObject$(new Bitstream()); @@ -80,7 +80,7 @@ export function getItemPageFieldsTest(mockItem: Item, component) { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(component); comp = fixture.componentInstance; comp.object = mockItem; diff --git a/src/app/+item-page/simple/item-types/untyped-item/untyped-item.component.spec.ts b/src/app/+item-page/simple/item-types/untyped-item/untyped-item.component.spec.ts index 93a2a22365..b7dc69aa78 100644 --- a/src/app/+item-page/simple/item-types/untyped-item/untyped-item.component.spec.ts +++ b/src/app/+item-page/simple/item-types/untyped-item/untyped-item.component.spec.ts @@ -1,6 +1,6 @@ import { HttpClient } from '@angular/common/http'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { Store } from '@ngrx/store'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; @@ -40,7 +40,7 @@ describe('UntypedItemComponent', () => { let comp: UntypedItemComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { const mockBitstreamDataService = { getThumbnailFor(item: Item): Observable> { return createSuccessfulRemoteDataObject$(new Bitstream()); @@ -77,7 +77,7 @@ describe('UntypedItemComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(UntypedItemComponent); comp = fixture.componentInstance; comp.object = mockItem; diff --git a/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.spec.ts b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.spec.ts index a2d0c4958c..25f54a3fd2 100644 --- a/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.spec.ts +++ b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { MetadataRepresentationListComponent } from './metadata-representation-list.component'; @@ -63,7 +63,7 @@ describe('MetadataRepresentationListComponent', () => { } ); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], declarations: [MetadataRepresentationListComponent, VarDirective], @@ -72,11 +72,11 @@ describe('MetadataRepresentationListComponent', () => { ], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(MetadataRepresentationListComponent, { - set: {changeDetection: ChangeDetectionStrategy.Default} + set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(MetadataRepresentationListComponent); comp = fixture.componentInstance; comp.parentItem = parentItem; diff --git a/src/app/+item-page/simple/related-entities/related-entities-search/related-entities-search.component.spec.ts b/src/app/+item-page/simple/related-entities/related-entities-search/related-entities-search.component.spec.ts index 46ab83ad6b..a75a0feae2 100644 --- a/src/app/+item-page/simple/related-entities/related-entities-search/related-entities-search.component.spec.ts +++ b/src/app/+item-page/simple/related-entities/related-entities-search/related-entities-search.component.spec.ts @@ -1,5 +1,5 @@ import { RelatedEntitiesSearchComponent } from './related-entities-search.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TranslateModule } from '@ngx-translate/core'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -15,9 +15,9 @@ describe('RelatedEntitiesSearchComponent', () => { }); const mockRelationType = 'publicationsOfAuthor'; const mockConfiguration = 'publication'; - const mockFilter= `f.${mockRelationType}=${mockItem.id},equals`; + const mockFilter = `f.${mockRelationType}=${mockItem.id},equals`; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), NoopAnimationsModule, FormsModule], declarations: [RelatedEntitiesSearchComponent], diff --git a/src/app/+item-page/simple/related-entities/tabbed-related-entities-search/tabbed-related-entities-search.component.spec.ts b/src/app/+item-page/simple/related-entities/tabbed-related-entities-search/tabbed-related-entities-search.component.spec.ts index 24ebc92c01..f7b9fb68e8 100644 --- a/src/app/+item-page/simple/related-entities/tabbed-related-entities-search/tabbed-related-entities-search.component.spec.ts +++ b/src/app/+item-page/simple/related-entities/tabbed-related-entities-search/tabbed-related-entities-search.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { Item } from '../../../../core/shared/item.model'; import { TranslateModule } from '@ngx-translate/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; @@ -27,7 +27,7 @@ describe('TabbedRelatedEntitiesSearchComponent', () => { const router = new RouterMock(); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), NoopAnimationsModule, NgbModule], declarations: [TabbedRelatedEntitiesSearchComponent, VarDirective], diff --git a/src/app/+item-page/simple/related-items/related-items.component.spec.ts b/src/app/+item-page/simple/related-items/related-items.component.spec.ts index 1a40c74340..751acb316a 100644 --- a/src/app/+item-page/simple/related-items/related-items.component.spec.ts +++ b/src/app/+item-page/simple/related-items/related-items.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { RelatedItemsComponent } from './related-items-component'; import { Item } from '../../../core/shared/item.model'; @@ -34,7 +34,7 @@ describe('RelatedItemsComponent', () => { let comp: RelatedItemsComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { relationshipService = jasmine.createSpyObj('relationshipService', { getRelatedItemsByLabel: createSuccessfulRemoteDataObject$(createPaginatedList(mockItems)), @@ -49,11 +49,11 @@ describe('RelatedItemsComponent', () => { ], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(RelatedItemsComponent, { - set: {changeDetection: ChangeDetectionStrategy.Default} + set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(RelatedItemsComponent); comp = fixture.componentInstance; comp.parentItem = parentItem; @@ -80,7 +80,10 @@ describe('RelatedItemsComponent', () => { }); it('should call relationship-service\'s getRelatedItemsByLabel with the correct arguments (second page)', () => { - expect(relationshipService.getRelatedItemsByLabel).toHaveBeenCalledWith(parentItem, relationType, Object.assign(comp.options, { elementsPerPage: comp.incrementBy, currentPage: 2 })); + expect(relationshipService.getRelatedItemsByLabel).toHaveBeenCalledWith(parentItem, relationType, Object.assign(comp.options, { + elementsPerPage: comp.incrementBy, + currentPage: 2 + })); }); }); diff --git a/src/app/+login-page/login-page.component.spec.ts b/src/app/+login-page/login-page.component.spec.ts index a2cb727976..241aa5f9b7 100644 --- a/src/app/+login-page/login-page.component.spec.ts +++ b/src/app/+login-page/login-page.component.spec.ts @@ -1,5 +1,5 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; import { Store } from '@ngrx/store'; @@ -23,7 +23,7 @@ describe('LoginPageComponent', () => { select: observableOf(true) }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot() diff --git a/src/app/+logout-page/logout-page.component.spec.ts b/src/app/+logout-page/logout-page.component.spec.ts index 49d4d846bc..327e64b756 100644 --- a/src/app/+logout-page/logout-page.component.spec.ts +++ b/src/app/+logout-page/logout-page.component.spec.ts @@ -1,5 +1,5 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { LogoutPageComponent } from './logout-page.component'; @@ -8,7 +8,7 @@ describe('LogoutPageComponent', () => { let comp: LogoutPageComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot() diff --git a/src/app/+lookup-by-id/objectnotfound/objectnotfound.component.spec.ts b/src/app/+lookup-by-id/objectnotfound/objectnotfound.component.spec.ts index be543c7c24..f0139e9251 100644 --- a/src/app/+lookup-by-id/objectnotfound/objectnotfound.component.spec.ts +++ b/src/app/+lookup-by-id/objectnotfound/objectnotfound.component.spec.ts @@ -1,5 +1,5 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { ObjectNotFoundComponent } from './objectnotfound.component'; @@ -21,7 +21,7 @@ describe('ObjectNotFoundComponent', () => { params: observableOf({id: handleId, idType: handlePrefix}) }); describe('uuid request', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot() @@ -51,7 +51,7 @@ describe('ObjectNotFoundComponent', () => { }); describe( 'legacy handle request', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot() diff --git a/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.spec.ts b/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.spec.ts index 3c0d13b958..29a2e593de 100644 --- a/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.spec.ts +++ b/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -11,7 +11,7 @@ describe('MyDSpaceResultsComponent', () => { let comp: MyDSpaceResultsComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), NoopAnimationsModule], declarations: [ diff --git a/src/app/+search-page/configuration-search-page.component.spec.ts b/src/app/+search-page/configuration-search-page.component.spec.ts index 1d02f578d1..f49d329edd 100644 --- a/src/app/+search-page/configuration-search-page.component.spec.ts +++ b/src/app/+search-page/configuration-search-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { configureSearchComponentTestingModule } from './search.component.spec'; import { ConfigurationSearchPageComponent } from './configuration-search-page.component'; import { SearchConfigurationService } from '../core/shared/search/search-configuration.service'; @@ -8,7 +8,7 @@ describe('ConfigurationSearchPageComponent', () => { let fixture: ComponentFixture; let searchConfigService: SearchConfigurationService; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { configureSearchComponentTestingModule(ConfigurationSearchPageComponent); })); diff --git a/src/app/+workflowitems-edit-page/workflow-item-action-page.component.spec.ts b/src/app/+workflowitems-edit-page/workflow-item-action-page.component.spec.ts index 979476bf03..c7b9858836 100644 --- a/src/app/+workflowitems-edit-page/workflow-item-action-page.component.spec.ts +++ b/src/app/+workflowitems-edit-page/workflow-item-action-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core'; import { WorkflowItemActionPageComponent } from './workflow-item-action-page.component'; @@ -36,7 +36,7 @@ describe('WorkflowItemActionPageComponent', () => { id = 'de11b5e5-064a-4e98-a7ac-a1a6a65ddf80'; } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [TranslateModule.forRoot({ diff --git a/src/app/+workflowitems-edit-page/workflow-item-delete/workflow-item-delete.component.spec.ts b/src/app/+workflowitems-edit-page/workflow-item-delete/workflow-item-delete.component.spec.ts index a70005776b..a4e8f7d849 100644 --- a/src/app/+workflowitems-edit-page/workflow-item-delete/workflow-item-delete.component.spec.ts +++ b/src/app/+workflowitems-edit-page/workflow-item-delete/workflow-item-delete.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { WorkflowItemDeleteComponent } from './workflow-item-delete.component'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; @@ -36,7 +36,7 @@ describe('WorkflowItemDeleteComponent', () => { id = 'de11b5e5-064a-4e98-a7ac-a1a6a65ddf80'; } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [TranslateModule.forRoot({ diff --git a/src/app/+workflowitems-edit-page/workflow-item-send-back/workflow-item-send-back.component.spec.ts b/src/app/+workflowitems-edit-page/workflow-item-send-back/workflow-item-send-back.component.spec.ts index fde48b59e4..d9dde8244c 100644 --- a/src/app/+workflowitems-edit-page/workflow-item-send-back/workflow-item-send-back.component.spec.ts +++ b/src/app/+workflowitems-edit-page/workflow-item-send-back/workflow-item-send-back.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { ActivatedRoute, Router } from '@angular/router'; @@ -36,7 +36,7 @@ describe('WorkflowItemSendBackComponent', () => { id = 'de11b5e5-064a-4e98-a7ac-a1a6a65ddf80'; } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [TranslateModule.forRoot({ diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index dc07bfe9f2..b1afe83b33 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -48,7 +48,7 @@ describe('App component', () => { }); } - // async beforeEach + // waitForAsync beforeEach beforeEach(waitForAsync(() => { return TestBed.configureTestingModule({ imports: [ diff --git a/src/app/breadcrumbs/breadcrumbs.component.spec.ts b/src/app/breadcrumbs/breadcrumbs.component.spec.ts index 2767b28b1d..f7f8789144 100644 --- a/src/app/breadcrumbs/breadcrumbs.component.spec.ts +++ b/src/app/breadcrumbs/breadcrumbs.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { BreadcrumbsComponent } from './breadcrumbs.component'; import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; @@ -64,7 +64,7 @@ describe('BreadcrumbsComponent', () => { } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ declarations: [BreadcrumbsComponent, VarDirective], diff --git a/src/app/community-list-page/community-list-page.component.spec.ts b/src/app/community-list-page/community-list-page.component.spec.ts index 346d414528..080a0a9e18 100644 --- a/src/app/community-list-page/community-list-page.component.spec.ts +++ b/src/app/community-list-page/community-list-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed, inject } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { CommunityListPageComponent } from './community-list-page.component'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; @@ -9,7 +9,7 @@ describe('CommunityListPageComponent', () => { let component: CommunityListPageComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot({ diff --git a/src/app/community-list-page/community-list/community-list.component.spec.ts b/src/app/community-list-page/community-list/community-list.component.spec.ts index ea6facce0e..1f020b7744 100644 --- a/src/app/community-list-page/community-list/community-list.component.spec.ts +++ b/src/app/community-list-page/community-list/community-list.component.spec.ts @@ -1,12 +1,7 @@ -import { async, ComponentFixture, fakeAsync, inject, TestBed, tick } from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, inject, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { CommunityListComponent } from './community-list.component'; -import { - CommunityListService, - FlatNode, - showMoreFlatNode, - toFlatNode -} from '../community-list-service'; +import { CommunityListService, FlatNode, showMoreFlatNode, toFlatNode } from '../community-list-service'; import { CdkTreeModule } from '@angular/cdk/tree'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { TranslateLoaderMock } from '../../shared/mocks/translate-loader.mock'; @@ -112,7 +107,7 @@ describe('CommunityListComponent', () => { ]; let communityListServiceStub; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { communityListServiceStub = { pageSize: 2, expandedNodes: [], diff --git a/src/app/core/auth/auth.interceptor.spec.ts b/src/app/core/auth/auth.interceptor.spec.ts index a58251cd73..029deb5326 100644 --- a/src/app/core/auth/auth.interceptor.spec.ts +++ b/src/app/core/auth/auth.interceptor.spec.ts @@ -31,14 +31,14 @@ describe(`AuthInterceptor`, () => { imports: [HttpClientTestingModule], providers: [ DspaceRestService, - {provide: AuthService, useValue: authServiceStub}, - {provide: Router, useClass: RouterStub}, + { provide: AuthService, useValue: authServiceStub }, + { provide: Router, useClass: RouterStub }, { provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true, }, - {provide: Store, useValue: store}, + { provide: Store, useValue: store }, ], }); diff --git a/src/app/core/auth/auth.service.spec.ts b/src/app/core/auth/auth.service.spec.ts index a4f071a5c5..505f925e8e 100644 --- a/src/app/core/auth/auth.service.spec.ts +++ b/src/app/core/auth/auth.service.spec.ts @@ -1,4 +1,4 @@ -import { async, inject, TestBed } from '@angular/core/testing'; +import { inject, TestBed, waitForAsync } from '@angular/core/testing'; import { CommonModule } from '@angular/common'; import { ActivatedRoute, Router } from '@angular/router'; import { Store, StoreModule } from '@ngrx/store'; @@ -184,7 +184,7 @@ describe('AuthService test', () => { describe('', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ @@ -253,7 +253,7 @@ describe('AuthService test', () => { }); describe('', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ @@ -470,7 +470,7 @@ describe('AuthService test', () => { }); describe('when user is not logged in', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ diff --git a/src/app/core/auth/models/short-lived-token.model.ts b/src/app/core/auth/models/short-lived-token.model.ts index e51f35fd58..118c724328 100644 --- a/src/app/core/auth/models/short-lived-token.model.ts +++ b/src/app/core/auth/models/short-lived-token.model.ts @@ -1,7 +1,7 @@ import { CacheableObject } from '../../cache/object-cache.reducer'; import { typedObject } from '../../cache/builders/build-decorators'; import { excludeFromEquals } from '../../utilities/equals.decorators'; -import { autoserialize, deserialize, autoserializeAs } from 'cerialize'; +import { autoserialize, autoserializeAs, deserialize } from 'cerialize'; import { ResourceType } from '../../shared/resource-type'; import { SHORT_LIVED_TOKEN } from './short-lived-token.resource-type'; import { HALLink } from '../../shared/hal-link.model'; diff --git a/src/app/core/breadcrumbs/dso-breadcrumb.resolver.spec.ts b/src/app/core/breadcrumbs/dso-breadcrumb.resolver.spec.ts index d507eef346..e35e26e46f 100644 --- a/src/app/core/breadcrumbs/dso-breadcrumb.resolver.spec.ts +++ b/src/app/core/breadcrumbs/dso-breadcrumb.resolver.spec.ts @@ -29,7 +29,7 @@ describe('DSOBreadcrumbResolver', () => { it('should resolve a breadcrumb config for the correct DSO', () => { const resolvedConfig = resolver.resolve({ params: { id: uuid } } as any, { url: currentUrl } as any); const expectedConfig = { provider: dsoBreadcrumbService, key: testCollection, url: breadcrumbUrl }; - getTestScheduler().expectObservable(resolvedConfig).toBe('(a|)', { a: expectedConfig}); + getTestScheduler().expectObservable(resolvedConfig).toBe('(a|)', { a: expectedConfig }); }); }); }); diff --git a/src/app/core/breadcrumbs/dso-breadcrumbs.service.spec.ts b/src/app/core/breadcrumbs/dso-breadcrumbs.service.spec.ts index f0dbc09d5d..6b89c576d6 100644 --- a/src/app/core/breadcrumbs/dso-breadcrumbs.service.spec.ts +++ b/src/app/core/breadcrumbs/dso-breadcrumbs.service.spec.ts @@ -1,4 +1,4 @@ -import { async, TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { DSOBreadcrumbsService } from './dso-breadcrumbs.service'; import { getMockLinkService } from '../../shared/mocks/link-service.mock'; import { LinkService } from '../cache/builders/link.service'; @@ -43,7 +43,7 @@ describe('DSOBreadcrumbsService', () => { { type: 'community', metadata: { - 'dc.title': [{value: 'community'}] + 'dc.title': [{ value: 'community' }] }, uuid: communityUUID, parentCommunity: observableOf(Object.assign(createSuccessfulRemoteDataObject(undefined), { statusCode: 204 })), @@ -59,7 +59,7 @@ describe('DSOBreadcrumbsService', () => { { type: 'collection', metadata: { - 'dc.title': [{value: 'collection'}] + 'dc.title': [{ value: 'collection' }] }, uuid: collectionUUID, parentCommunity: createSuccessfulRemoteDataObject$(testCommunity), @@ -74,7 +74,7 @@ describe('DSOBreadcrumbsService', () => { { type: 'item', metadata: { - 'dc.title': [{value: 'item'}] + 'dc.title': [{ value: 'item' }] }, uuid: itemUUID, owningCollection: createSuccessfulRemoteDataObject$(testCollection), @@ -88,7 +88,7 @@ describe('DSOBreadcrumbsService', () => { dsoNameService = { getName: (dso) => getName(dso) }; } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ providers: [ diff --git a/src/app/core/breadcrumbs/i18n-breadcrumbs.service.spec.ts b/src/app/core/breadcrumbs/i18n-breadcrumbs.service.spec.ts index 047c466dfc..ac2f244037 100644 --- a/src/app/core/breadcrumbs/i18n-breadcrumbs.service.spec.ts +++ b/src/app/core/breadcrumbs/i18n-breadcrumbs.service.spec.ts @@ -1,4 +1,4 @@ -import { async, TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { Breadcrumb } from '../../breadcrumbs/breadcrumb/breadcrumb.model'; import { getTestScheduler } from 'jasmine-marbles'; import { BREADCRUMB_MESSAGE_POSTFIX, I18nBreadcrumbsService } from './i18n-breadcrumbs.service'; @@ -13,7 +13,7 @@ describe('I18nBreadcrumbsService', () => { exampleURL = 'example.com'; } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({}).compileComponents(); })); diff --git a/src/app/core/browse/browse-definition-data.service.spec.ts b/src/app/core/browse/browse-definition-data.service.spec.ts index f1e2a0948b..418bbb2f0e 100644 --- a/src/app/core/browse/browse-definition-data.service.spec.ts +++ b/src/app/core/browse/browse-definition-data.service.spec.ts @@ -24,24 +24,24 @@ describe(`BrowseDefinitionDataService`, () => { }); describe(`findAll`, () => { - it(`should call findAll on DataServiceImpl`, () => { - service.findAll(options, false, ...linksToFollow); - expect(dataServiceImplSpy.findAll).toHaveBeenCalledWith(options, false, ...linksToFollow); - }); + it(`should call findAll on DataServiceImpl`, () => { + service.findAll(options, false, ...linksToFollow); + expect(dataServiceImplSpy.findAll).toHaveBeenCalledWith(options, false, ...linksToFollow); + }); }); describe(`findByHref`, () => { - it(`should call findByHref on DataServiceImpl`, () => { - service.findByHref(hrefSingle, false, ...linksToFollow); - expect(dataServiceImplSpy.findByHref).toHaveBeenCalledWith(hrefSingle, false, ...linksToFollow); - }); + it(`should call findByHref on DataServiceImpl`, () => { + service.findByHref(hrefSingle, false, ...linksToFollow); + expect(dataServiceImplSpy.findByHref).toHaveBeenCalledWith(hrefSingle, false, ...linksToFollow); + }); }); describe(`findAllByHref`, () => { - it(`should call findAllByHref on DataServiceImpl`, () => { - service.findAllByHref(hrefAll, options, false, ...linksToFollow); - expect(dataServiceImplSpy.findAllByHref).toHaveBeenCalledWith(hrefAll, options, false, ...linksToFollow); - }); + it(`should call findAllByHref on DataServiceImpl`, () => { + service.findAllByHref(hrefAll, options, false, ...linksToFollow); + expect(dataServiceImplSpy.findAllByHref).toHaveBeenCalledWith(hrefAll, options, false, ...linksToFollow); + }); }); }); diff --git a/src/app/core/cache/builders/build-decorators.spec.ts b/src/app/core/cache/builders/build-decorators.spec.ts index d7c40534bf..0c6074630b 100644 --- a/src/app/core/cache/builders/build-decorators.spec.ts +++ b/src/app/core/cache/builders/build-decorators.spec.ts @@ -1,16 +1,15 @@ import { HALLink } from '../../shared/hal-link.model'; import { HALResource } from '../../shared/hal-resource.model'; import { ResourceType } from '../../shared/resource-type'; -import { - dataService, - getDataServiceFor, - getLinkDefinition, - link, -} from './build-decorators'; +import { dataService, getDataServiceFor, getLinkDefinition, link, } from './build-decorators'; /* tslint:disable:max-classes-per-file */ -class TestService {} -class AnotherTestService {} +class TestService { +} + +class AnotherTestService { +} + class TestHALResource implements HALResource { _links: { self: HALLink; @@ -19,6 +18,7 @@ class TestHALResource implements HALResource { bar?: any; } + let testType; describe('build decorators', () => { diff --git a/src/app/core/cache/builders/link.service.spec.ts b/src/app/core/cache/builders/link.service.spec.ts index e2fd2664df..544dd20bd4 100644 --- a/src/app/core/cache/builders/link.service.spec.ts +++ b/src/app/core/cache/builders/link.service.spec.ts @@ -41,6 +41,7 @@ class TestDataService { findAllByHref(href: string, findListOptions: FindListOptions = {}, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig[]) { return 'findAllByHref'; } + findByHref(href: string, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig[]) { return 'findByHref'; } @@ -104,10 +105,10 @@ xdescribe('LinkService', () => { isList: true }); spyOnFunction(decorators, 'getDataServiceFor').and.returnValue(TestDataService); - service.resolveLink(testModel, followLink('predecessor', { some: 'options '} as any, true, followLink('successor'))); + service.resolveLink(testModel, followLink('predecessor', { some: 'options ' } as any, true, followLink('successor'))); }); it('should call dataservice.findAllByHref with the correct href, findListOptions, and nested links', () => { - expect(testDataService.findAllByHref).toHaveBeenCalledWith(testModel._links.predecessor.href, { some: 'options '} as any, true, followLink('successor')); + expect(testDataService.findAllByHref).toHaveBeenCalledWith(testModel._links.predecessor.href, { some: 'options ' } as any, true, followLink('successor')); }); }); describe('either way', () => { diff --git a/src/app/core/cache/builders/remote-data-build.service.spec.ts b/src/app/core/cache/builders/remote-data-build.service.spec.ts index fe759d7e51..fbaa52f956 100644 --- a/src/app/core/cache/builders/remote-data-build.service.spec.ts +++ b/src/app/core/cache/builders/remote-data-build.service.spec.ts @@ -14,7 +14,7 @@ import { UnCacheableObject } from '../../shared/uncacheable-object.model'; import { RemoteData } from '../../data/remote-data'; import { Observable, of as observableOf } from 'rxjs'; import { RequestEntry, RequestEntryState } from '../../data/request.reducer'; -import { FollowLinkConfig, followLink } from '../../../shared/utils/follow-link-config.model'; +import { followLink, FollowLinkConfig } from '../../../shared/utils/follow-link-config.model'; import { take } from 'rxjs/operators'; import { HALLink } from '../../shared/hal-link.model'; @@ -397,7 +397,7 @@ describe('RemoteDataBuildService', () => { }); it(`should return false if the requestEntry's request has no id`, () => { - expect((service as any).hasExactMatchInObjectCache('href', { request: {}})).toEqual(false); + expect((service as any).hasExactMatchInObjectCache('href', { request: {} })).toEqual(false); }); }); diff --git a/src/app/core/cache/object-cache.service.spec.ts b/src/app/core/cache/object-cache.service.spec.ts index 7f4a019948..6863361c34 100644 --- a/src/app/core/cache/object-cache.service.spec.ts +++ b/src/app/core/cache/object-cache.service.spec.ts @@ -82,11 +82,11 @@ describe('ObjectCacheService', () => { operations = [{ op: 'replace', path: '/name', value: 'random string' } as Operation]; initialState = { core: { - 'cache/object': { }, - 'cache/syncbuffer': { }, - 'cache/object-updates': { }, - 'data/request': { }, - 'index': { } + 'cache/object': {}, + 'cache/syncbuffer': {}, + 'cache/object-updates': {}, + 'data/request': {}, + 'index': {} } }; } diff --git a/src/app/core/cache/server-sync-buffer.effects.spec.ts b/src/app/core/cache/server-sync-buffer.effects.spec.ts index 98a6097fee..a236d3bb71 100644 --- a/src/app/core/cache/server-sync-buffer.effects.spec.ts +++ b/src/app/core/cache/server-sync-buffer.effects.spec.ts @@ -117,9 +117,9 @@ describe('ServerSyncBufferEffects', () => { }); const expected = cold('(bc)', { - b: new ApplyPatchObjectCacheAction(selfLink), - c: new EmptySSBAction(RestRequestMethod.PATCH) - }); + b: new ApplyPatchObjectCacheAction(selfLink), + c: new EmptySSBAction(RestRequestMethod.PATCH) + }); expect(ssbEffects.commitServerSyncBuffer).toBeObservable(expected); }); diff --git a/src/app/core/data/base-response-parsing.service.spec.ts b/src/app/core/data/base-response-parsing.service.spec.ts index 6011cdd45c..94285d49d8 100644 --- a/src/app/core/data/base-response-parsing.service.spec.ts +++ b/src/app/core/data/base-response-parsing.service.spec.ts @@ -42,7 +42,9 @@ describe('BaseResponseParsingService', () => { describe('cache', () => { describe('when the object is undefined', () => { it('should not throw an error', () => { - expect(() => { service.cache(obj, request, {}); }).not.toThrow(); + expect(() => { + service.cache(obj, request, {}); + }).not.toThrow(); }); it('should not call objectCache add', () => { @@ -82,7 +84,9 @@ describe('BaseResponseParsingService', () => { }); it('should not throw an error', () => { - expect(() => { result = service.process(data, request); }).not.toThrow(); + expect(() => { + result = service.process(data, request); + }).not.toThrow(); }); it('should return undefined', () => { diff --git a/src/app/core/data/bitstream-format-data.service.spec.ts b/src/app/core/data/bitstream-format-data.service.spec.ts index 1df0ad23fd..b754b49eb7 100644 --- a/src/app/core/data/bitstream-format-data.service.spec.ts +++ b/src/app/core/data/bitstream-format-data.service.spec.ts @@ -10,7 +10,7 @@ import { NotificationsService } from '../../shared/notifications/notifications.s import { HttpClient } from '@angular/common/http'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { BitstreamFormat } from '../shared/bitstream-format.model'; -import { async } from '@angular/core/testing'; +import { waitForAsync } from '@angular/core/testing'; import { BitstreamFormatsRegistryDeselectAction, BitstreamFormatsRegistryDeselectAllAction, @@ -40,7 +40,7 @@ describe('BitstreamFormatDataService', () => { const objectCache = {} as ObjectCacheService; const halEndpointService = { getEndpoint(linkPath: string): Observable { - return cold('a', {a: bitstreamFormatsEndpoint}); + return cold('a', { a: bitstreamFormatsEndpoint }); } } as HALEndpointService; @@ -70,12 +70,12 @@ describe('BitstreamFormatDataService', () => { } describe('getBrowseEndpoint', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { scheduler = getTestScheduler(); requestService = jasmine.createSpyObj('requestService', { configure: {}, getByHref: observableOf(responseCacheEntry), - getByUUID: cold('a', {a: responseCacheEntry}), + getByUUID: cold('a', { a: responseCacheEntry }), generateRequestId: 'request-id', removeByHrefSubstring: {} }); @@ -83,19 +83,19 @@ describe('BitstreamFormatDataService', () => { })); it('should get the browse endpoint', () => { const result = service.getBrowseEndpoint(); - const expected = cold('b', {b: bitstreamFormatsEndpoint}); + const expected = cold('b', { b: bitstreamFormatsEndpoint }); expect(result).toBeObservable(expected); }); }); describe('getUpdateEndpoint', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { scheduler = getTestScheduler(); requestService = jasmine.createSpyObj('requestService', { configure: {}, getByHref: observableOf(responseCacheEntry), - getByUUID: cold('a', {a: responseCacheEntry}), + getByUUID: cold('a', { a: responseCacheEntry }), generateRequestId: 'request-id', removeByHrefSubstring: {} }); @@ -105,19 +105,19 @@ describe('BitstreamFormatDataService', () => { const formatId = 'format-id'; const result = service.getUpdateEndpoint(formatId); - const expected = cold('b', {b: bitstreamFormatsIdEndpoint}); + const expected = cold('b', { b: bitstreamFormatsIdEndpoint }); expect(result).toBeObservable(expected); }); }); describe('getCreateEndpoint', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { scheduler = getTestScheduler(); requestService = jasmine.createSpyObj('requestService', { configure: {}, getByHref: observableOf(responseCacheEntry), - getByUUID: cold('a', {a: responseCacheEntry}), + getByUUID: cold('a', { a: responseCacheEntry }), generateRequestId: 'request-id', removeByHrefSubstring: {} }); @@ -126,19 +126,19 @@ describe('BitstreamFormatDataService', () => { it('should get the create endpoint ', () => { const result = service.getCreateEndpoint(); - const expected = cold('b', {b: bitstreamFormatsEndpoint}); + const expected = cold('b', { b: bitstreamFormatsEndpoint }); expect(result).toBeObservable(expected); }); }); describe('updateBitstreamFormat', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { scheduler = getTestScheduler(); requestService = jasmine.createSpyObj('requestService', { configure: {}, getByHref: observableOf(responseCacheEntry), - getByUUID: cold('a', {a: responseCacheEntry}), + getByUUID: cold('a', { a: responseCacheEntry }), generateRequestId: 'request-id', removeByHrefSubstring: {} }); @@ -148,7 +148,7 @@ describe('BitstreamFormatDataService', () => { const updatedBistreamFormat = new BitstreamFormat(); updatedBistreamFormat.uuid = 'updated-uuid'; - const expected = cold('(b|)', {b: rd}); + const expected = cold('(b|)', { b: rd }); const result = service.updateBitstreamFormat(updatedBistreamFormat); expect(result).toBeObservable(expected); @@ -157,12 +157,12 @@ describe('BitstreamFormatDataService', () => { }); describe('createBitstreamFormat', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { scheduler = getTestScheduler(); requestService = jasmine.createSpyObj('requestService', { configure: {}, getByHref: observableOf(responseCacheEntry), - getByUUID: cold('a', {a: responseCacheEntry}), + getByUUID: cold('a', { a: responseCacheEntry }), generateRequestId: 'request-id', removeByHrefSubstring: {} }); @@ -172,7 +172,7 @@ describe('BitstreamFormatDataService', () => { const newFormat = new BitstreamFormat(); newFormat.uuid = 'new-uuid'; - const expected = cold('(b|)', {b: rd}); + const expected = cold('(b|)', { b: rd }); const result = service.createBitstreamFormat(newFormat); expect(result).toBeObservable(expected); @@ -180,12 +180,12 @@ describe('BitstreamFormatDataService', () => { }); describe('clearBitStreamFormatRequests', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { scheduler = getTestScheduler(); requestService = jasmine.createSpyObj('requestService', { configure: {}, getByHref: observableOf(responseCacheEntry), - getByUUID: cold('a', {a: responseCacheEntry}), + getByUUID: cold('a', { a: responseCacheEntry }), generateRequestId: 'request-id', removeByHrefSubstring: {} }); @@ -203,12 +203,12 @@ describe('BitstreamFormatDataService', () => { }); describe('selectBitstreamFormat', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { scheduler = getTestScheduler(); requestService = jasmine.createSpyObj('requestService', { configure: {}, getByHref: observableOf(responseCacheEntry), - getByUUID: cold('a', {a: responseCacheEntry}), + getByUUID: cold('a', { a: responseCacheEntry }), generateRequestId: 'request-id', removeByHrefSubstring: {} }); @@ -225,12 +225,12 @@ describe('BitstreamFormatDataService', () => { }); describe('deselectBitstreamFormat', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { scheduler = getTestScheduler(); requestService = jasmine.createSpyObj('requestService', { configure: {}, getByHref: observableOf(responseCacheEntry), - getByUUID: cold('a', {a: responseCacheEntry}), + getByUUID: cold('a', { a: responseCacheEntry }), generateRequestId: 'request-id', removeByHrefSubstring: {} }); @@ -247,12 +247,12 @@ describe('BitstreamFormatDataService', () => { }); describe('deselectAllBitstreamFormats', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { scheduler = getTestScheduler(); requestService = jasmine.createSpyObj('requestService', { configure: {}, getByHref: observableOf(responseCacheEntry), - getByUUID: cold('a', {a: responseCacheEntry}), + getByUUID: cold('a', { a: responseCacheEntry }), generateRequestId: 'request-id', removeByHrefSubstring: {} }); @@ -267,12 +267,12 @@ describe('BitstreamFormatDataService', () => { }); describe('delete', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { scheduler = getTestScheduler(); requestService = jasmine.createSpyObj('requestService', { configure: {}, getByHref: observableOf(responseCacheEntry), - getByUUID: hot('a', {a: responseCacheEntry}), + getByUUID: hot('a', { a: responseCacheEntry }), generateRequestId: 'request-id', removeByHrefSubstring: {} }); diff --git a/src/app/core/data/collection-data.service.spec.ts b/src/app/core/data/collection-data.service.spec.ts index 5738e4ab12..0045b21dc1 100644 --- a/src/app/core/data/collection-data.service.spec.ts +++ b/src/app/core/data/collection-data.service.spec.ts @@ -213,7 +213,7 @@ describe('CollectionDataService', () => { notificationsService = new NotificationsServiceStub(); translate = getMockTranslateService(); - service = new CollectionDataService(requestService, rdbService, null, null, objectCache, halService, notificationsService, null, null,null, translate); + service = new CollectionDataService(requestService, rdbService, null, null, objectCache, halService, notificationsService, null, null, null, translate); } }); diff --git a/src/app/core/data/configuration-data.service.spec.ts b/src/app/core/data/configuration-data.service.spec.ts index fde55070e1..3d4fc32a7b 100644 --- a/src/app/core/data/configuration-data.service.spec.ts +++ b/src/app/core/data/configuration-data.service.spec.ts @@ -30,7 +30,7 @@ describe('ConfigurationDataService', () => { scheduler = getTestScheduler(); halService = jasmine.createSpyObj('halService', { - getEndpoint: cold('a', {a: configLink}) + getEndpoint: cold('a', { a: configLink }) }); requestService = jasmine.createSpyObj('requestService', { generateRequestId: requestUUID, diff --git a/src/app/core/data/data.service.spec.ts b/src/app/core/data/data.service.spec.ts index d45d6b8aef..cf82fdcc2e 100644 --- a/src/app/core/data/data.service.spec.ts +++ b/src/app/core/data/data.service.spec.ts @@ -164,10 +164,12 @@ describe('DataService', () => { }); it('should include all searchParams in href if any provided in options', () => { - options = { searchParams: [ - new RequestParam('param1', 'test'), - new RequestParam('param2', 'test2'), - ] }; + options = { + searchParams: [ + new RequestParam('param1', 'test'), + new RequestParam('param2', 'test2'), + ] + }; const expected = `${endpoint}?param1=test¶m2=test2`; (service as any).getFindAllHref(options).subscribe((value) => { diff --git a/src/app/core/data/dspace-object-data.service.spec.ts b/src/app/core/data/dspace-object-data.service.spec.ts index 554c24d547..4f62af3f6f 100644 --- a/src/app/core/data/dspace-object-data.service.spec.ts +++ b/src/app/core/data/dspace-object-data.service.spec.ts @@ -9,6 +9,7 @@ import { DSpaceObjectDataService } from './dspace-object-data.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { HttpClient } from '@angular/common/http'; + describe('DSpaceObjectDataService', () => { let scheduler: TestScheduler; let service: DSpaceObjectDataService; diff --git a/src/app/core/data/eperson-registration.service.spec.ts b/src/app/core/data/eperson-registration.service.spec.ts index d71a9da849..04cf24dd02 100644 --- a/src/app/core/data/eperson-registration.service.spec.ts +++ b/src/app/core/data/eperson-registration.service.spec.ts @@ -33,7 +33,7 @@ describe('EpersonRegistrationService', () => { generateRequestId: 'request-id', configure: {}, getByUUID: cold('a', - {a: Object.assign(new RequestEntry(), {response: new RestResponse(true, 200, 'Success')})}) + { a: Object.assign(new RequestEntry(), { response: new RestResponse(true, 200, 'Success') }) }) }); rdbService = jasmine.createSpyObj('rdbService', { buildFromRequestUUID: observableOf(rd) @@ -71,7 +71,7 @@ describe('EpersonRegistrationService', () => { const expected = service.registerEmail('test@mail.org'); expect(requestService.configure).toHaveBeenCalledWith(new PostRequest('request-id', 'rest-url/registrations', registration)); - expect(expected).toBeObservable(cold('(a|)', {a: rd})); + expect(expected).toBeObservable(cold('(a|)', { a: rd })); }); }); diff --git a/src/app/core/data/item-template-data.service.spec.ts b/src/app/core/data/item-template-data.service.spec.ts index a7607a7879..8a9744567c 100644 --- a/src/app/core/data/item-template-data.service.spec.ts +++ b/src/app/core/data/item-template-data.service.spec.ts @@ -58,7 +58,7 @@ describe('ItemTemplateDataService', () => { } as any; const halEndpointService = { getEndpoint(linkPath: string): Observable { - return cold('a', {a: itemEndpoint}); + return cold('a', { a: itemEndpoint }); } } as HALEndpointService; const notificationsService = {} as NotificationsService; diff --git a/src/app/core/data/lookup-relation.service.spec.ts b/src/app/core/data/lookup-relation.service.spec.ts index 325db64662..876336bfa9 100644 --- a/src/app/core/data/lookup-relation.service.spec.ts +++ b/src/app/core/data/lookup-relation.service.spec.ts @@ -43,7 +43,12 @@ describe('LookupRelationService', () => { function init() { externalSourceService = jasmine.createSpyObj('externalSourceService', { - getExternalSourceEntries: createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ elementsPerPage: 1, totalElements: totalExternal, totalPages: totalExternal, currentPage: 1 }), [{}])) + getExternalSourceEntries: createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ + elementsPerPage: 1, + totalElements: totalExternal, + totalPages: totalExternal, + currentPage: 1 + }), [{}])) }); searchService = jasmine.createSpyObj('searchService', { search: createSuccessfulRemoteDataObject$(createPaginatedList(localResults)), diff --git a/src/app/core/data/object-updates/object-updates.effects.spec.ts b/src/app/core/data/object-updates/object-updates.effects.spec.ts index 90b6082f7e..8c4467c0c0 100644 --- a/src/app/core/data/object-updates/object-updates.effects.spec.ts +++ b/src/app/core/data/object-updates/object-updates.effects.spec.ts @@ -1,4 +1,4 @@ -import { async, TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { Observable, Subject } from 'rxjs'; import { provideMockActions } from '@ngrx/effects/testing'; import { cold, hot } from 'jasmine-marbles'; @@ -11,10 +11,7 @@ import { RemoveFieldUpdateAction, RemoveObjectUpdatesAction } from './object-updates.actions'; -import { - INotification, - Notification -} from '../../../shared/notifications/models/notification.model'; +import { INotification, Notification } from '../../../shared/notifications/models/notification.model'; import { NotificationType } from '../../../shared/notifications/models/notification-type'; import { filter } from 'rxjs/operators'; import { hasValue } from '../../../shared/empty.util'; @@ -25,7 +22,7 @@ describe('ObjectUpdatesEffects', () => { let testURL = 'www.dspace.org/dspace7'; let testUUID = '20e24c2f-a00a-467c-bdee-c929e79bf08d'; const fakeID = 'id'; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ providers: [ ObjectUpdatesEffects, @@ -84,9 +81,9 @@ describe('ObjectUpdatesEffects', () => { updatesEffects.removeAfterDiscardOrReinstateOnUndo$.pipe( filter(((action) => hasValue(action)))) .subscribe((t) => { - expect(t).toEqual(removeAction); - } - ) + expect(t).toEqual(removeAction); + } + ) ; }); }); diff --git a/src/app/core/data/object-updates/object-updates.reducer.spec.ts b/src/app/core/data/object-updates/object-updates.reducer.spec.ts index b822da7e15..4d7fce24a7 100644 --- a/src/app/core/data/object-updates/object-updates.reducer.spec.ts +++ b/src/app/core/data/object-updates/object-updates.reducer.spec.ts @@ -49,7 +49,7 @@ const identifiable3 = { language: null, value: 'Unchanged value' }; -const relationship: Relationship = Object.assign(new Relationship(), {uuid: 'test relationship uuid'}); +const relationship: Relationship = Object.assign(new Relationship(), { uuid: 'test relationship uuid' }); const modDate = new Date(2010, 2, 11); const uuid = identifiable1.uuid; @@ -87,7 +87,7 @@ describe('objectUpdatesReducer', () => { }, lastModified: modDate, virtualMetadataSources: { - [relationship.uuid]: {[identifiable1.uuid]: true} + [relationship.uuid]: { [identifiable1.uuid]: true } }, } }; @@ -113,7 +113,7 @@ describe('objectUpdatesReducer', () => { }, lastModified: modDate, virtualMetadataSources: { - [relationship.uuid]: {[identifiable1.uuid]: true} + [relationship.uuid]: { [identifiable1.uuid]: true } }, }, [url + OBJECT_UPDATES_TRASH_PATH]: { @@ -147,7 +147,7 @@ describe('objectUpdatesReducer', () => { }, lastModified: modDate, virtualMetadataSources: { - [relationship.uuid]: {[identifiable1.uuid]: true} + [relationship.uuid]: { [identifiable1.uuid]: true } }, } }; diff --git a/src/app/core/data/object-updates/object-updates.service.spec.ts b/src/app/core/data/object-updates/object-updates.service.spec.ts index e188fc289d..6c0b0f99c4 100644 --- a/src/app/core/data/object-updates/object-updates.service.spec.ts +++ b/src/app/core/data/object-updates/object-updates.service.spec.ts @@ -27,7 +27,7 @@ describe('ObjectUpdatesService', () => { const identifiable2 = { uuid: '26cbb5ce-5786-4e57-a394-b9fcf8eaf241' }; const identifiable3 = { uuid: 'c5d2c2f7-d757-48bf-84cc-8c9229c8407e' }; const identifiables = [identifiable1, identifiable2]; - const relationship: Relationship = Object.assign(new Relationship(), {uuid: 'test relationship uuid'}); + const relationship: Relationship = Object.assign(new Relationship(), { uuid: 'test relationship uuid' }); const fieldUpdates = { [identifiable1.uuid]: { field: identifiable1Updated, changeType: FieldChangeType.UPDATE }, diff --git a/src/app/core/data/object-updates/patch-operation-service/metadata-patch-operation.service.spec.ts b/src/app/core/data/object-updates/patch-operation-service/metadata-patch-operation.service.spec.ts index f3578b1bde..9708266cd7 100644 --- a/src/app/core/data/object-updates/patch-operation-service/metadata-patch-operation.service.spec.ts +++ b/src/app/core/data/object-updates/patch-operation-service/metadata-patch-operation.service.spec.ts @@ -52,7 +52,7 @@ describe('MetadataPatchOperationService', () => { } }); expected = [ - { op: 'add', path: '/metadata/dc.title/-', value: [ { value: 'Added title', language: undefined } ] } + { op: 'add', path: '/metadata/dc.title/-', value: [{ value: 'Added title', language: undefined }] } ] as any[]; result = service.fieldUpdatesToPatchOperations(fieldUpdates); }); diff --git a/src/app/core/data/registration-response-parsing.service.spec.ts b/src/app/core/data/registration-response-parsing.service.spec.ts index 1f69ed9705..6cff89ff72 100644 --- a/src/app/core/data/registration-response-parsing.service.spec.ts +++ b/src/app/core/data/registration-response-parsing.service.spec.ts @@ -4,11 +4,11 @@ import { ParsedResponse } from '../cache/response.models'; describe('RegistrationResponseParsingService', () => { describe('parse', () => { - const registration = Object.assign(new Registration(), {email: 'test@email.org', token: 'test-token'}); + const registration = Object.assign(new Registration(), { email: 'test@email.org', token: 'test-token' }); const registrationResponseParsingService = new RegistrationResponseParsingService(); const data = { - payload: {email: 'test@email.org', token: 'test-token'}, + payload: { email: 'test@email.org', token: 'test-token' }, statusCode: 200, statusText: 'Success' }; diff --git a/src/app/core/data/relationship-type.service.spec.ts b/src/app/core/data/relationship-type.service.spec.ts index a6d111e629..e37148f06c 100644 --- a/src/app/core/data/relationship-type.service.spec.ts +++ b/src/app/core/data/relationship-type.service.spec.ts @@ -37,9 +37,9 @@ describe('RelationshipTypeService', () => { publicationTypeString = 'Publication'; personTypeString = 'Person'; orgUnitTypeString = 'OrgUnit'; - publicationType = Object.assign(new ItemType(), {label: publicationTypeString}); - personType = Object.assign(new ItemType(), {label: personTypeString}); - orgUnitType = Object.assign(new ItemType(), {label: orgUnitTypeString}); + publicationType = Object.assign(new ItemType(), { label: publicationTypeString }); + personType = Object.assign(new ItemType(), { label: personTypeString }); + orgUnitType = Object.assign(new ItemType(), { label: orgUnitTypeString }); relationshipType1 = Object.assign(new RelationshipType(), { id: '1', @@ -72,6 +72,7 @@ describe('RelationshipTypeService', () => { itemService = undefined; } + function initTestService() { return new RelationshipTypeService( itemService, diff --git a/src/app/core/data/relationship.service.spec.ts b/src/app/core/data/relationship.service.spec.ts index 6eb5724931..da8c4312a2 100644 --- a/src/app/core/data/relationship.service.spec.ts +++ b/src/app/core/data/relationship.service.spec.ts @@ -12,10 +12,7 @@ import { RelationshipService } from './relationship.service'; import { RequestService } from './request.service'; import { RequestEntry } from './request.reducer'; import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-service.stub'; -import { - createSuccessfulRemoteDataObject, - createSuccessfulRemoteDataObject$ -} from '../../shared/remote-data.utils'; +import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils'; import { getMockRemoteDataBuildServiceHrefMap } from '../../shared/mocks/remote-data-build.service.mock'; import { getMockRequestService } from '../../shared/mocks/request.service.mock'; import { createPaginatedList, spyOnOperator } from '../../shared/testing/utils.test'; @@ -106,7 +103,10 @@ xdescribe('RelationshipService', () => { const buildList$ = createSuccessfulRemoteDataObject$(createPaginatedList(relatedItems)); const relationships$ = createSuccessfulRemoteDataObject$(createPaginatedList(relationships)); - const rdbService = getMockRemoteDataBuildServiceHrefMap(undefined, {'href': buildList$, 'https://rest.api/core/publication/relationships': relationships$}); + const rdbService = getMockRemoteDataBuildServiceHrefMap(undefined, { + 'href': buildList$, + 'https://rest.api/core/publication/relationships': relationships$ + }); const objectCache = Object.assign({ /* tslint:disable:no-empty */ remove: () => { diff --git a/src/app/core/data/request.reducer.spec.ts b/src/app/core/data/request.reducer.spec.ts index 7f39df6781..3e210220fe 100644 --- a/src/app/core/data/request.reducer.spec.ts +++ b/src/app/core/data/request.reducer.spec.ts @@ -4,9 +4,9 @@ import { RequestErrorAction, RequestExecuteAction, RequestRemoveAction, + RequestStaleAction, RequestSuccessAction, - ResetResponseTimestampsAction, - RequestStaleAction + ResetResponseTimestampsAction } from './request.actions'; import { GetRequest } from './request.models'; import { RequestEntryState, requestReducer, RequestState } from './request.reducer'; @@ -120,7 +120,7 @@ describe('requestReducer', () => { statusCode: 200 } }); - const state = Object.assign({}, testInitState, {[id1]: update}); + const state = Object.assign({}, testInitState, { [id1]: update }); const timeStamp = 1000; const action = new ResetResponseTimestampsAction(timeStamp); const newState = requestReducer(state, action); diff --git a/src/app/core/data/request.service.spec.ts b/src/app/core/data/request.service.spec.ts index 6b11f6dd37..24a5623e0e 100644 --- a/src/app/core/data/request.service.spec.ts +++ b/src/app/core/data/request.service.spec.ts @@ -46,11 +46,11 @@ describe('RequestService', () => { const initialState: any = { core: { - 'cache/object': { }, - 'cache/syncbuffer': { }, - 'cache/object-updates': { }, - 'data/request': { }, - 'index': { }, + 'cache/object': {}, + 'cache/syncbuffer': {}, + 'cache/object-updates': {}, + 'data/request': {}, + 'index': {}, } }; @@ -249,7 +249,7 @@ describe('RequestService', () => { }); }); - }); + }); describe('getByHref', () => { describe('when the request with the specified href exists in the store', () => { diff --git a/src/app/core/data/site-data.service.spec.ts b/src/app/core/data/site-data.service.spec.ts index 354593fce1..5d174aec6e 100644 --- a/src/app/core/data/site-data.service.spec.ts +++ b/src/app/core/data/site-data.service.spec.ts @@ -35,7 +35,7 @@ describe('SiteDataService', () => { scheduler = getTestScheduler(); halService = jasmine.createSpyObj('halService', { - getEndpoint: cold('a', {a: siteLink}) + getEndpoint: cold('a', { a: siteLink }) }); requestService = jasmine.createSpyObj('requestService', { generateRequestId: requestUUID, @@ -69,7 +69,7 @@ describe('SiteDataService', () => { it('should return the Static Page endpoint', () => { const result = service.getBrowseEndpoint(options); - const expected = cold('b', {b: siteLink}); + const expected = cold('b', { b: siteLink }); expect(result).toBeObservable(expected); }); @@ -82,7 +82,7 @@ describe('SiteDataService', () => { a: createSuccessfulRemoteDataObject(createPaginatedList([testObject])) })); - const expected = cold('(b|)', {b: testObject}); + const expected = cold('(b|)', { b: testObject }); const result = service.find(); expect(result).toBeObservable(expected); diff --git a/src/app/core/dspace-rest/dspace-rest.service.spec.ts b/src/app/core/dspace-rest/dspace-rest.service.spec.ts index 84d5bfa37b..2188522dc0 100644 --- a/src/app/core/dspace-rest/dspace-rest.service.spec.ts +++ b/src/app/core/dspace-rest/dspace-rest.service.spec.ts @@ -1,4 +1,4 @@ -import { TestBed, inject } from '@angular/core/testing'; +import { inject, TestBed } from '@angular/core/testing'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { DEFAULT_CONTENT_TYPE, DspaceRestService } from './dspace-rest.service'; diff --git a/src/app/core/end-user-agreement/end-user-agreement-current-user.guard.spec.ts b/src/app/core/end-user-agreement/end-user-agreement-current-user.guard.spec.ts index 1892509aef..75b8f6089e 100644 --- a/src/app/core/end-user-agreement/end-user-agreement-current-user.guard.spec.ts +++ b/src/app/core/end-user-agreement/end-user-agreement-current-user.guard.spec.ts @@ -2,7 +2,6 @@ import { EndUserAgreementCurrentUserGuard } from './end-user-agreement-current-u import { EndUserAgreementService } from './end-user-agreement.service'; import { Router, UrlTree } from '@angular/router'; import { of as observableOf } from 'rxjs'; -import { AuthService } from '../auth/auth.service'; describe('EndUserAgreementGuard', () => { let guard: EndUserAgreementCurrentUserGuard; diff --git a/src/app/core/eperson/eperson-data.service.spec.ts b/src/app/core/eperson/eperson-data.service.spec.ts index 7415f48f81..231693d61a 100644 --- a/src/app/core/eperson/eperson-data.service.spec.ts +++ b/src/app/core/eperson/eperson-data.service.spec.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { async, TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { Store, StoreModule } from '@ngrx/store'; import { compare, Operation } from 'fast-json-patch'; import { getTestScheduler } from 'jasmine-marbles'; @@ -70,7 +70,7 @@ describe('EPersonDataService', () => { TranslateModule.forRoot({ loader: { provide: TranslateLoader, - useClass: TranslateLoaderMock + useClass: TranslateLoaderMock } }), ], @@ -225,7 +225,7 @@ describe('EPersonDataService', () => { }); describe('clearEPersonRequests', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { scheduler = getTestScheduler(); halService = { getEndpoint(linkPath: string): Observable { @@ -292,7 +292,7 @@ describe('EPersonDataService', () => { }); describe('patchPasswordWithToken', () => { it('should sent a patch request with an uuid, token and new password to the epersons endpoint', () => { - service.patchPasswordWithToken('test-uuid', 'test-token','test-password'); + service.patchPasswordWithToken('test-uuid', 'test-token', 'test-password'); const operation = Object.assign({ op: 'add', path: '/password', value: 'test-password' }); const expected = new PatchRequest(requestService.generateRequestId(), epersonsEndpoint + '/test-uuid?token=test-token', [operation]); diff --git a/src/app/core/forward-client-ip/forward-client-ip.interceptor.spec.ts b/src/app/core/forward-client-ip/forward-client-ip.interceptor.spec.ts index d48ab796e6..bd9e4f9076 100644 --- a/src/app/core/forward-client-ip/forward-client-ip.interceptor.spec.ts +++ b/src/app/core/forward-client-ip/forward-client-ip.interceptor.spec.ts @@ -25,7 +25,7 @@ describe('ForwardClientIpInterceptor', () => { useClass: ForwardClientIpInterceptor, multi: true, }, - { provide: REQUEST, useValue: { get: () => undefined, connection: { remoteAddress: clientIp } }} + { provide: REQUEST, useValue: { get: () => undefined, connection: { remoteAddress: clientIp } } } ], }); diff --git a/src/app/core/index/index.effects.spec.ts b/src/app/core/index/index.effects.spec.ts index 5883083e26..b7e89e87ca 100644 --- a/src/app/core/index/index.effects.spec.ts +++ b/src/app/core/index/index.effects.spec.ts @@ -1,5 +1,5 @@ import { Observable } from 'rxjs'; -import { async, TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { provideMockActions } from '@ngrx/effects/testing'; import { UUIDIndexEffects } from './index.effects'; import { cold, hot } from 'jasmine-marbles'; @@ -36,7 +36,7 @@ describe('ObjectUpdatesEffects', () => { alternativeLink = 'rest.org/alternative-link/1234'; } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ providers: [ diff --git a/src/app/core/json-patch/json-patch-operations.effects.spec.ts b/src/app/core/json-patch/json-patch-operations.effects.spec.ts index e86f053a5f..9f836fe54d 100644 --- a/src/app/core/json-patch/json-patch-operations.effects.spec.ts +++ b/src/app/core/json-patch/json-patch-operations.effects.spec.ts @@ -26,7 +26,7 @@ describe('JsonPatchOperationsEffects test suite', () => { TestBed.configureTestingModule({ providers: [ JsonPatchOperationsEffects, - {provide: Store, useValue: store}, + { provide: Store, useValue: store }, provideMockActions(() => actions), // other providers ], @@ -40,7 +40,7 @@ describe('JsonPatchOperationsEffects test suite', () => { actions = hot('--a-', { a: { type: JsonPatchOperationsActionTypes.COMMIT_JSON_PATCH_OPERATIONS, - payload: {resourceType: testJsonPatchResourceType, resourceId: testJsonPatchResourceId} + payload: { resourceType: testJsonPatchResourceType, resourceId: testJsonPatchResourceId } } }); diff --git a/src/app/core/json-patch/json-patch-operations.reducer.spec.ts b/src/app/core/json-patch/json-patch-operations.reducer.spec.ts index e41e164d66..34378b819b 100644 --- a/src/app/core/json-patch/json-patch-operations.reducer.spec.ts +++ b/src/app/core/json-patch/json-patch-operations.reducer.spec.ts @@ -42,25 +42,25 @@ describe('jsonPatchOperationsReducer test suite', () => { const timestampAfterStart = 1545994837492; const startTimestamp = 1545994827492; const testState: JsonPatchOperationsState = { - testResourceType: { - children: { - testResourceId: { - body: [ - { - operation: { - op: 'add', - path: '/testResourceType/testResourceId/testField', - value: ['test'] - }, - timeCompleted: timestampBeforeStart - }, - ] - } as JsonPatchOperationsEntry - }, - transactionStartTime: null, - commitPending: false - } as JsonPatchOperationsResourceEntry - }; + testResourceType: { + children: { + testResourceId: { + body: [ + { + operation: { + op: 'add', + path: '/testResourceType/testResourceId/testField', + value: ['test'] + }, + timeCompleted: timestampBeforeStart + }, + ] + } as JsonPatchOperationsEntry + }, + transactionStartTime: null, + commitPending: false + } as JsonPatchOperationsResourceEntry + }; let initState: JsonPatchOperationsState; diff --git a/src/app/core/locale/locale.interceptor.spec.ts b/src/app/core/locale/locale.interceptor.spec.ts index 6405747371..9e298fefcc 100644 --- a/src/app/core/locale/locale.interceptor.spec.ts +++ b/src/app/core/locale/locale.interceptor.spec.ts @@ -30,7 +30,7 @@ describe(`LocaleInterceptor`, () => { useClass: LocaleInterceptor, multi: true, }, - {provide: LocaleService, useValue: mockLocaleService}, + { provide: LocaleService, useValue: mockLocaleService }, ], }); diff --git a/src/app/core/locale/locale.service.spec.ts b/src/app/core/locale/locale.service.spec.ts index 78aa793f6e..5fbeceb37a 100644 --- a/src/app/core/locale/locale.service.spec.ts +++ b/src/app/core/locale/locale.service.spec.ts @@ -99,14 +99,14 @@ describe('LocaleService test suite', () => { it('should set the given language', () => { service.setCurrentLanguageCode('it'); - expect(translateService.use).toHaveBeenCalledWith( 'it'); + expect(translateService.use).toHaveBeenCalledWith('it'); expect(service.saveLanguageCodeToCookie).toHaveBeenCalledWith('it'); }); it('should set the current language', () => { spyOn(service, 'getCurrentLanguageCode').and.returnValue('es'); service.setCurrentLanguageCode(); - expect(translateService.use).toHaveBeenCalledWith( 'es'); + expect(translateService.use).toHaveBeenCalledWith('es'); expect(service.saveLanguageCodeToCookie).toHaveBeenCalledWith('es'); }); }); diff --git a/src/app/core/metadata/metadata.service.spec.ts b/src/app/core/metadata/metadata.service.spec.ts index 06d8d0b3f2..c093dcb1b5 100644 --- a/src/app/core/metadata/metadata.service.spec.ts +++ b/src/app/core/metadata/metadata.service.spec.ts @@ -38,7 +38,7 @@ import { DefaultChangeAnalyzer } from '../data/default-change-analyzer.service'; import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service'; import { ItemDataService } from '../data/item-data.service'; -import { PaginatedList, buildPaginatedList } from '../data/paginated-list.model'; +import { buildPaginatedList, PaginatedList } from '../data/paginated-list.model'; import { FindListOptions } from '../data/request.models'; import { RequestService } from '../data/request.service'; import { BitstreamFormat } from '../shared/bitstream-format.model'; @@ -57,7 +57,7 @@ import { URLCombiner } from '../url-combiner/url-combiner'; /* tslint:disable:max-classes-per-file */ @Component({ template: ` - ` + ` }) class TestComponent { constructor(private metadata: MetadataService) { @@ -171,8 +171,16 @@ describe('MetadataService', () => { Meta, Title, // tslint:disable-next-line:no-empty - { provide: ItemDataService, useValue: { findById: () => {} } }, - { provide: HardRedirectService, useValue: { rewriteDownloadURL: (a) => a, getRequestOrigin: () => environment.ui.baseUrl }}, + { + provide: ItemDataService, useValue: { + findById: () => { + } + } + }, + { + provide: HardRedirectService, + useValue: { rewriteDownloadURL: (a) => a, getRequestOrigin: () => environment.ui.baseUrl } + }, BrowseService, MetadataService ], diff --git a/src/app/core/registry/registry.service.spec.ts b/src/app/core/registry/registry.service.spec.ts index 30d2617ef7..62a5f68929 100644 --- a/src/app/core/registry/registry.service.spec.ts +++ b/src/app/core/registry/registry.service.spec.ts @@ -26,10 +26,7 @@ import { storeModuleConfig } from '../../app.reducer'; import { FindListOptions } from '../data/request.models'; import { MetadataSchemaDataService } from '../data/metadata-schema-data.service'; import { MetadataFieldDataService } from '../data/metadata-field-data.service'; -import { - createNoContentRemoteDataObject$, - createSuccessfulRemoteDataObject$ -} from '../../shared/remote-data.utils'; +import { createNoContentRemoteDataObject$, createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils'; import { createPaginatedList } from '../../shared/testing/utils.test'; import { RemoteData } from '../data/remote-data'; import { NoContent } from '../shared/NoContent.model'; diff --git a/src/app/core/services/browser-hard-redirect.service.spec.ts b/src/app/core/services/browser-hard-redirect.service.spec.ts index cd7b8ea416..d0fecd9be5 100644 --- a/src/app/core/services/browser-hard-redirect.service.spec.ts +++ b/src/app/core/services/browser-hard-redirect.service.spec.ts @@ -1,5 +1,5 @@ -import {TestBed} from '@angular/core/testing'; -import {BrowserHardRedirectService} from './browser-hard-redirect.service'; +import { TestBed } from '@angular/core/testing'; +import { BrowserHardRedirectService } from './browser-hard-redirect.service'; describe('BrowserHardRedirectService', () => { const origin = 'test origin'; diff --git a/src/app/core/services/cookie.service.spec.ts b/src/app/core/services/cookie.service.spec.ts index 21593a25c7..630fc9f755 100644 --- a/src/app/core/services/cookie.service.spec.ts +++ b/src/app/core/services/cookie.service.spec.ts @@ -1,15 +1,15 @@ import { CookieService, ICookieService } from './cookie.service'; -import { async, TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { REQUEST } from '@nguniversal/express-engine/tokens'; describe(CookieService.name, () => { let service: ICookieService; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ providers: [ CookieService, - {provide: REQUEST, useValue: {}} + { provide: REQUEST, useValue: {} } ] }); })); @@ -22,7 +22,7 @@ describe(CookieService.name, () => { TestBed.resetTestingModule(); }); - it('should construct', async(() => { + it('should construct', waitForAsync(() => { expect(service).toBeDefined(); })); }); diff --git a/src/app/core/services/route.service.spec.ts b/src/app/core/services/route.service.spec.ts index 31cb1a3c53..c4b2aebcb1 100644 --- a/src/app/core/services/route.service.spec.ts +++ b/src/app/core/services/route.service.spec.ts @@ -1,5 +1,5 @@ import { ActivatedRoute, convertToParamMap, NavigationEnd, Params, Router } from '@angular/router'; -import { async, TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { of as observableOf } from 'rxjs'; import { Store } from '@ngrx/store'; @@ -35,7 +35,7 @@ describe('RouteService', () => { paramObject[paramName1] = paramValue1; paramObject[paramName2] = [paramValue2a, paramValue2b]; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { return TestBed.configureTestingModule({ providers: [ { diff --git a/src/app/core/shared/collection.model.spec.ts b/src/app/core/shared/collection.model.spec.ts index 98bf03022f..d264829ff0 100644 --- a/src/app/core/shared/collection.model.spec.ts +++ b/src/app/core/shared/collection.model.spec.ts @@ -1,13 +1,13 @@ -import {Collection} from './collection.model'; +import { Collection } from './collection.model'; describe('Collection', () => { - describe('Collection handle value', () => { + describe('Collection handle value', () => { let metadataValue; beforeEach(() => { - metadataValue = {'dc.identifier.uri': [ { value: '123456789/1'}]}; + metadataValue = { 'dc.identifier.uri': [{ value: '123456789/1' }] }; }); it('should return the handle value from metadata', () => { @@ -16,7 +16,7 @@ describe('Collection', () => { }); it('should return undefined if the handle value from metadata is not present', () => { - const community = Object.assign(new Collection(), { }); + const community = Object.assign(new Collection(), {}); expect(community.handle).toEqual(undefined); }); }); diff --git a/src/app/core/shared/community.model.spec.ts b/src/app/core/shared/community.model.spec.ts index 81ad7e23ba..9b3ebfb85a 100644 --- a/src/app/core/shared/community.model.spec.ts +++ b/src/app/core/shared/community.model.spec.ts @@ -1,13 +1,13 @@ -import {Community} from './community.model'; +import { Community } from './community.model'; describe('Community', () => { - describe('Community handle value', () => { + describe('Community handle value', () => { let metadataValue; beforeEach(() => { - metadataValue = {'dc.identifier.uri': [ { value: '123456789/1'}]}; + metadataValue = { 'dc.identifier.uri': [{ value: '123456789/1' }] }; }); it('should return the handle value from metadata', () => { @@ -16,7 +16,7 @@ describe('Community', () => { }); it('should return undefined if the handle value from metadata is not present', () => { - const community = Object.assign(new Community(), { }); + const community = Object.assign(new Community(), {}); expect(community.handle).toEqual(undefined); }); }); diff --git a/src/app/core/shared/hal-endpoint.service.spec.ts b/src/app/core/shared/hal-endpoint.service.spec.ts index 3f7e642285..aa24c539de 100644 --- a/src/app/core/shared/hal-endpoint.service.spec.ts +++ b/src/app/core/shared/hal-endpoint.service.spec.ts @@ -3,7 +3,7 @@ import { getMockRequestService } from '../../shared/mocks/request.service.mock'; import { RequestService } from '../data/request.service'; import { HALEndpointService } from './hal-endpoint.service'; import { EndpointMapRequest } from '../data/request.models'; -import { of as observableOf, combineLatest as observableCombineLatest } from 'rxjs'; +import { combineLatest as observableCombineLatest, of as observableOf } from 'rxjs'; import { environment } from '../../../environments/environment'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils'; diff --git a/src/app/core/shared/metadata.utils.spec.ts b/src/app/core/shared/metadata.utils.spec.ts index 75e28b2dbc..ec0b3dd3ba 100644 --- a/src/app/core/shared/metadata.utils.spec.ts +++ b/src/app/core/shared/metadata.utils.spec.ts @@ -1,16 +1,17 @@ import { isUndefined } from '../../shared/empty.util'; import * as uuidv4 from 'uuid/v4'; -import { - MetadataMap, - MetadataValue, - MetadataValueFilter, - MetadatumViewModel -} from './metadata.models'; +import { MetadataMap, MetadataValue, MetadataValueFilter, MetadatumViewModel } from './metadata.models'; import { Metadata } from './metadata.utils'; -import { beforeEach } from 'selenium-webdriver/testing'; const mdValue = (value: string, language?: string, authority?: string): MetadataValue => { - return Object.assign(new MetadataValue(), { uuid: uuidv4(), value: value, language: isUndefined(language) ? null : language, place: 0, authority: isUndefined(authority) ? null : authority, confidence: undefined }); + return Object.assign(new MetadataValue(), { + uuid: uuidv4(), + value: value, + language: isUndefined(language) ? null : language, + place: 0, + authority: isUndefined(authority) ? null : authority, + confidence: undefined + }); }; const dcDescription = mdValue('Some description'); diff --git a/src/app/core/shared/operators.spec.ts b/src/app/core/shared/operators.spec.ts index 9909d472c6..e1dceba061 100644 --- a/src/app/core/shared/operators.spec.ts +++ b/src/app/core/shared/operators.spec.ts @@ -7,18 +7,15 @@ import { RequestService } from '../data/request.service'; import { configureRequest, getAllSucceededRemoteData, + getFirstSucceededRemoteData, getRemoteDataPayload, getRequestFromRequestHref, getRequestFromRequestUUID, getResponseFromEntry, - getFirstSucceededRemoteData, redirectOn4xx } from './operators'; import { of as observableOf } from 'rxjs'; -import { - createFailedRemoteDataObject, - createSuccessfulRemoteDataObject -} from '../../shared/remote-data.utils'; +import { createFailedRemoteDataObject, createSuccessfulRemoteDataObject } from '../../shared/remote-data.utils'; describe('Core Module - RxJS Operators', () => { let scheduler: TestScheduler; diff --git a/src/app/core/shared/search/search.service.spec.ts b/src/app/core/shared/search/search.service.spec.ts index 3cda2bd8af..2fc85b6110 100644 --- a/src/app/core/shared/search/search.service.spec.ts +++ b/src/app/core/shared/search/search.service.spec.ts @@ -141,7 +141,7 @@ describe('SearchService', () => { it('should return ViewMode.List when the viewMode is set to ViewMode.List in the ActivatedRoute', () => { let viewMode = ViewMode.GridElement; spyOn(routeService, 'getQueryParamMap').and.returnValue(observableOf(new Map([ - [ 'view', ViewMode.ListElement ], + ['view', ViewMode.ListElement], ]))); searchService.getViewMode().subscribe((mode) => viewMode = mode); @@ -151,7 +151,7 @@ describe('SearchService', () => { it('should return ViewMode.Grid when the viewMode is set to ViewMode.Grid in the ActivatedRoute', () => { let viewMode = ViewMode.ListElement; spyOn(routeService, 'getQueryParamMap').and.returnValue(observableOf(new Map([ - [ 'view', ViewMode.GridElement ], + ['view', ViewMode.GridElement], ]))); searchService.getViewMode().subscribe((mode) => viewMode = mode); expect(viewMode).toEqual(ViewMode.GridElement); diff --git a/src/app/core/submission/submission-object-data.service.spec.ts b/src/app/core/submission/submission-object-data.service.spec.ts index f6891f399e..378eef33a6 100644 --- a/src/app/core/submission/submission-object-data.service.spec.ts +++ b/src/app/core/submission/submission-object-data.service.spec.ts @@ -22,10 +22,10 @@ describe('SubmissionObjectDataService', () => { workspaceitemDataService = jasmine.createSpyObj('WorkspaceitemDataService', { findById: wsiResult }); - workflowItemDataService = jasmine.createSpyObj('WorkflowItemDataService', { + workflowItemDataService = jasmine.createSpyObj('WorkflowItemDataService', { findById: wfiResult }); - halService = jasmine.createSpyObj('HALEndpointService', { + halService = jasmine.createSpyObj('HALEndpointService', { getEndpoint: '/workspaceItem' }); }); diff --git a/src/app/core/submission/submission-rest.service.spec.ts b/src/app/core/submission/submission-rest.service.spec.ts index e57a350e55..16a4ef3319 100644 --- a/src/app/core/submission/submission-rest.service.spec.ts +++ b/src/app/core/submission/submission-rest.service.spec.ts @@ -25,7 +25,7 @@ describe('SubmissionRestService test suite', () => { const resourceEndpointURL = 'https://rest.api/endpoint'; const resourceEndpoint = 'workspaceitems'; const resourceScope = '260'; - const body = { test: new FormFieldMetadataValueObject('test')}; + const body = { test: new FormFieldMetadataValueObject('test') }; const resourceHref = resourceEndpointURL + '/' + resourceEndpoint + '/' + resourceScope + '?projection=full'; const timestampResponse = 1545994811992; diff --git a/src/app/core/tasks/tasks.service.spec.ts b/src/app/core/tasks/tasks.service.spec.ts index 3fdb7a1612..3a355dc46c 100644 --- a/src/app/core/tasks/tasks.service.spec.ts +++ b/src/app/core/tasks/tasks.service.spec.ts @@ -48,6 +48,7 @@ class DummyChangeAnalyzer implements ChangeAnalyzer { } } + /* tslint:enable:max-classes-per-file */ describe('TasksService', () => { diff --git a/src/app/curation-form/curation-form.component.spec.ts b/src/app/curation-form/curation-form.component.spec.ts index 96583f44d7..4ff013f77c 100644 --- a/src/app/curation-form/curation-form.component.spec.ts +++ b/src/app/curation-form/curation-form.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { CurationFormComponent } from './curation-form.component'; @@ -28,7 +28,7 @@ describe('CurationFormComponent', () => { const process = Object.assign(new Process(), {processId: 'process-id'}); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { scriptDataService = jasmine.createSpyObj('scriptDataService', { invoke: createSuccessfulRemoteDataObject$(process) diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.spec.ts index 65782a05ce..df9e8ea7fd 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.spec.ts @@ -4,7 +4,7 @@ import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-dat import { buildPaginatedList } from '../../../../core/data/paginated-list.model'; import { PageInfo } from '../../../../core/shared/page-info.model'; import { of as observableOf } from 'rxjs'; -import { async, TestBed } from '@angular/core/testing'; +import { waitForAsync, TestBed } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TruncatePipe } from '../../../../shared/utils/truncate.pipe'; import { TruncatableService } from '../../../../shared/truncatable/truncatable.service'; @@ -43,7 +43,7 @@ describe('JournalIssueGridElementComponent', () => { isCollapsed: (id: number) => observableOf(true), }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [JournalIssueGridElementComponent, TruncatePipe], @@ -56,7 +56,7 @@ describe('JournalIssueGridElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(JournalIssueGridElementComponent); comp = fixture.componentInstance; })); diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.spec.ts index e2f9039959..ac082e7f1b 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.spec.ts @@ -4,7 +4,7 @@ import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-dat import { buildPaginatedList } from '../../../../core/data/paginated-list.model'; import { PageInfo } from '../../../../core/shared/page-info.model'; import { of as observableOf } from 'rxjs'; -import { async, TestBed } from '@angular/core/testing'; +import { waitForAsync, TestBed } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TruncatePipe } from '../../../../shared/utils/truncate.pipe'; import { TruncatableService } from '../../../../shared/truncatable/truncatable.service'; @@ -43,7 +43,7 @@ describe('JournalVolumeGridElementComponent', () => { isCollapsed: (id: number) => observableOf(true), }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [JournalVolumeGridElementComponent, TruncatePipe], @@ -56,7 +56,7 @@ describe('JournalVolumeGridElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(JournalVolumeGridElementComponent); comp = fixture.componentInstance; })); diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.spec.ts index abc9f170a6..93287313aa 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.spec.ts @@ -4,7 +4,7 @@ import { JournalGridElementComponent } from './journal-grid-element.component'; import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils'; import { buildPaginatedList } from '../../../../core/data/paginated-list.model'; import { PageInfo } from '../../../../core/shared/page-info.model'; -import { async, TestBed } from '@angular/core/testing'; +import { waitForAsync, TestBed } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TruncatePipe } from '../../../../shared/utils/truncate.pipe'; import { TruncatableService } from '../../../../shared/truncatable/truncatable.service'; @@ -49,7 +49,7 @@ describe('JournalGridElementComponent', () => { isCollapsed: (id: number) => observableOf(true), }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [JournalGridElementComponent, TruncatePipe], @@ -62,7 +62,7 @@ describe('JournalGridElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(JournalGridElementComponent); comp = fixture.componentInstance; })); diff --git a/src/app/entity-groups/journal-entities/item-list-elements/journal-issue/journal-issue-list-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-list-elements/journal-issue/journal-issue-list-element.component.spec.ts index 107776d16d..8c33ffdc1e 100644 --- a/src/app/entity-groups/journal-entities/item-list-elements/journal-issue/journal-issue-list-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-list-elements/journal-issue/journal-issue-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, TestBed } from '@angular/core/testing'; +import { waitForAsync, TestBed } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { JournalIssueListElementComponent } from './journal-issue-list-element.component'; @@ -39,7 +39,7 @@ describe('JournalIssueListElementComponent', () => { isCollapsed: (id: number) => observableOf(true), }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [JournalIssueListElementComponent, TruncatePipe], providers: [ @@ -51,7 +51,7 @@ describe('JournalIssueListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(JournalIssueListElementComponent); comp = fixture.componentInstance; })); diff --git a/src/app/entity-groups/journal-entities/item-list-elements/journal-volume/journal-volume-list-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-list-elements/journal-volume/journal-volume-list-element.component.spec.ts index 14ea91204a..f4bf0d250b 100644 --- a/src/app/entity-groups/journal-entities/item-list-elements/journal-volume/journal-volume-list-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-list-elements/journal-volume/journal-volume-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, TestBed } from '@angular/core/testing'; +import { waitForAsync, TestBed } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { JournalVolumeListElementComponent } from './journal-volume-list-element.component'; @@ -39,7 +39,7 @@ describe('JournalVolumeListElementComponent', () => { isCollapsed: (id: number) => observableOf(true), }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [JournalVolumeListElementComponent, TruncatePipe], providers: [ @@ -51,7 +51,7 @@ describe('JournalVolumeListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(JournalVolumeListElementComponent); comp = fixture.componentInstance; })); diff --git a/src/app/entity-groups/journal-entities/item-list-elements/journal/journal-list-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-list-elements/journal/journal-list-element.component.spec.ts index 8b8ca974f6..b82876e364 100644 --- a/src/app/entity-groups/journal-entities/item-list-elements/journal/journal-list-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-list-elements/journal/journal-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, TestBed } from '@angular/core/testing'; +import { waitForAsync, TestBed } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { JournalListElementComponent } from './journal-list-element.component'; @@ -33,7 +33,7 @@ describe('JournalListElementComponent', () => { isCollapsed: (id: number) => observableOf(true), }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [JournalListElementComponent, TruncatePipe], providers: [ @@ -45,7 +45,7 @@ describe('JournalListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(JournalListElementComponent); comp = fixture.componentInstance; })); diff --git a/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-issue/journal-issue-search-result-list-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-issue/journal-issue-search-result-list-element.component.spec.ts index 34a5f93d7c..9f15cc9816 100644 --- a/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-issue/journal-issue-search-result-list-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-issue/journal-issue-search-result-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { of as observableOf } from 'rxjs'; @@ -56,7 +56,7 @@ const mockItemWithoutMetadata: ItemSearchResult = Object.assign( }); describe('JournalIssueSearchResultListElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [JournalIssueSearchResultListElementComponent, TruncatePipe], providers: [ @@ -69,7 +69,7 @@ describe('JournalIssueSearchResultListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(JournalIssueSearchResultListElementComponent); journalIssueListElementComponent = fixture.componentInstance; diff --git a/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-volume/journal-volume-search-result-list-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-volume/journal-volume-search-result-list-element.component.spec.ts index 64e2ff2e59..b39129fbd2 100644 --- a/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-volume/journal-volume-search-result-list-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal-volume/journal-volume-search-result-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { of as observableOf } from 'rxjs'; @@ -55,7 +55,7 @@ const mockItemWithoutMetadata: ItemSearchResult = Object.assign( }); describe('JournalVolumeSearchResultListElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [JournalVolumeSearchResultListElementComponent, TruncatePipe], providers: [ @@ -68,7 +68,7 @@ describe('JournalVolumeSearchResultListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(JournalVolumeSearchResultListElementComponent); journalVolumeListElementComponent = fixture.componentInstance; diff --git a/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal/journal-search-result-list-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal/journal-search-result-list-element.component.spec.ts index 2af226bfb3..5ab60e97b7 100644 --- a/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal/journal-search-result-list-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-list-elements/search-result-list-elements/journal/journal-search-result-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { of as observableOf } from 'rxjs'; @@ -51,7 +51,7 @@ const mockItemWithoutMetadata: ItemSearchResult = Object.assign( ); describe('JournalSearchResultListElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [JournalSearchResultListElementComponent, TruncatePipe], providers: [ @@ -64,7 +64,7 @@ describe('JournalSearchResultListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(JournalSearchResultListElementComponent); journalListElementComponent = fixture.componentInstance; diff --git a/src/app/entity-groups/journal-entities/item-pages/journal/journal.component.spec.ts b/src/app/entity-groups/journal-entities/item-pages/journal/journal.component.spec.ts index bc565b0beb..34ac45a63a 100644 --- a/src/app/entity-groups/journal-entities/item-pages/journal/journal.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-pages/journal/journal.component.spec.ts @@ -1,6 +1,6 @@ import { HttpClient } from '@angular/common/http'; import { ChangeDetectionStrategy, DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { Store } from '@ngrx/store'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; @@ -62,7 +62,7 @@ describe('JournalComponent', () => { return createSuccessfulRemoteDataObject$(new Bitstream()); } }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot({ loader: { @@ -94,7 +94,7 @@ describe('JournalComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(JournalComponent); comp = fixture.componentInstance; comp.object = mockItem; diff --git a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.spec.ts b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.spec.ts index 39762b01e0..b4d563b0d5 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.spec.ts @@ -4,7 +4,7 @@ import { PersonGridElementComponent } from './person-grid-element.component'; import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils'; import { buildPaginatedList } from '../../../../core/data/paginated-list.model'; import { PageInfo } from '../../../../core/shared/page-info.model'; -import { async, TestBed } from '@angular/core/testing'; +import { waitForAsync, TestBed } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TruncatePipe } from '../../../../shared/utils/truncate.pipe'; import { TruncatableService } from '../../../../shared/truncatable/truncatable.service'; @@ -43,7 +43,7 @@ describe('PersonGridElementComponent', () => { isCollapsed: (id: number) => observableOf(true), }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [PersonGridElementComponent, TruncatePipe], @@ -56,7 +56,7 @@ describe('PersonGridElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(PersonGridElementComponent); comp = fixture.componentInstance; })); diff --git a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.spec.ts b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.spec.ts index f5a68930f5..5f4808bd2a 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.spec.ts @@ -4,7 +4,7 @@ import { ProjectGridElementComponent } from './project-grid-element.component'; import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils'; import { buildPaginatedList } from '../../../../core/data/paginated-list.model'; import { PageInfo } from '../../../../core/shared/page-info.model'; -import { async, TestBed } from '@angular/core/testing'; +import { waitForAsync, TestBed } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TruncatePipe } from '../../../../shared/utils/truncate.pipe'; import { TruncatableService } from '../../../../shared/truncatable/truncatable.service'; @@ -37,7 +37,7 @@ describe('ProjectGridElementComponent', () => { isCollapsed: (id: number) => observableOf(true), }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [ProjectGridElementComponent, TruncatePipe], @@ -50,7 +50,7 @@ describe('ProjectGridElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ProjectGridElementComponent); comp = fixture.componentInstance; })); diff --git a/src/app/entity-groups/research-entities/item-list-elements/org-unit/org-unit-list-element.component.spec.ts b/src/app/entity-groups/research-entities/item-list-elements/org-unit/org-unit-list-element.component.spec.ts index fedfcf35c9..1cca1d3314 100644 --- a/src/app/entity-groups/research-entities/item-list-elements/org-unit/org-unit-list-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-list-elements/org-unit/org-unit-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, TestBed } from '@angular/core/testing'; +import { waitForAsync, TestBed } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { OrgUnitListElementComponent } from './org-unit-list-element.component'; @@ -33,7 +33,7 @@ describe('OrgUnitListElementComponent', () => { isCollapsed: (id: number) => observableOf(true), }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [OrgUnitListElementComponent, TruncatePipe], providers: [ @@ -45,7 +45,7 @@ describe('OrgUnitListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(OrgUnitListElementComponent); comp = fixture.componentInstance; })); diff --git a/src/app/entity-groups/research-entities/item-list-elements/person/person-list-element.component.spec.ts b/src/app/entity-groups/research-entities/item-list-elements/person/person-list-element.component.spec.ts index 10c799e139..8e86a129ce 100644 --- a/src/app/entity-groups/research-entities/item-list-elements/person/person-list-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-list-elements/person/person-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { PersonListElementComponent } from './person-list-element.component'; @@ -33,7 +33,7 @@ describe('PersonListElementComponent', () => { isCollapsed: (id: number) => observableOf(true), }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [PersonListElementComponent, TruncatePipe], providers: [ @@ -45,7 +45,7 @@ describe('PersonListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(PersonListElementComponent); comp = fixture.componentInstance; })); diff --git a/src/app/entity-groups/research-entities/item-list-elements/project/project-list-element.component.spec.ts b/src/app/entity-groups/research-entities/item-list-elements/project/project-list-element.component.spec.ts index 8db265837f..0c08d7eaaa 100644 --- a/src/app/entity-groups/research-entities/item-list-elements/project/project-list-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-list-elements/project/project-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, TestBed } from '@angular/core/testing'; +import { waitForAsync, TestBed } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { of as observableOf } from 'rxjs'; @@ -33,7 +33,7 @@ describe('ProjectListElementComponent', () => { isCollapsed: (id: number) => observableOf(true), }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ProjectListElementComponent, TruncatePipe], providers: [ @@ -45,7 +45,7 @@ describe('ProjectListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ProjectListElementComponent); comp = fixture.componentInstance; })); diff --git a/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/org-unit/org-unit-search-result-list-element.component.spec.ts b/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/org-unit/org-unit-search-result-list-element.component.spec.ts index dfc9716075..29bb069121 100644 --- a/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/org-unit/org-unit-search-result-list-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/org-unit/org-unit-search-result-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { of as observableOf } from 'rxjs'; @@ -49,7 +49,7 @@ const mockItemWithoutMetadata: ItemSearchResult = Object.assign( }); describe('OrgUnitSearchResultListElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ OrgUnitSearchResultListElementComponent , TruncatePipe], providers: [ @@ -62,7 +62,7 @@ describe('OrgUnitSearchResultListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(OrgUnitSearchResultListElementComponent); orgUnitListElementComponent = fixture.componentInstance; diff --git a/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/person/person-search-result-list-element.component.spec.ts b/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/person/person-search-result-list-element.component.spec.ts index c10ad5d88e..08fdf821d3 100644 --- a/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/person/person-search-result-list-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/person/person-search-result-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { of as observableOf } from 'rxjs'; @@ -49,7 +49,7 @@ const mockItemWithoutMetadata: ItemSearchResult = Object.assign( }); describe('PersonSearchResultListElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [PersonSearchResultListElementComponent, TruncatePipe], providers: [ @@ -62,7 +62,7 @@ describe('PersonSearchResultListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(PersonSearchResultListElementComponent); personListElementComponent = fixture.componentInstance; diff --git a/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/project/project-search-result-list-element.component.spec.ts b/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/project/project-search-result-list-element.component.spec.ts index 89eaad162b..1d45d98281 100644 --- a/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/project/project-search-result-list-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/project/project-search-result-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { of as observableOf } from 'rxjs'; import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model'; @@ -49,7 +49,7 @@ const mockItemWithoutMetadata: ItemSearchResult = Object.assign( }); describe('ProjectSearchResultListElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ProjectSearchResultListElementComponent, TruncatePipe], providers: [ @@ -62,7 +62,7 @@ describe('ProjectSearchResultListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ProjectSearchResultListElementComponent); projectListElementComponent = fixture.componentInstance; diff --git a/src/app/entity-groups/research-entities/submission/item-list-elements/external-source-entry/external-source-entry-list-submission-element.component.spec.ts b/src/app/entity-groups/research-entities/submission/item-list-elements/external-source-entry/external-source-entry-list-submission-element.component.spec.ts index fa153b8c5e..a5d56c1554 100644 --- a/src/app/entity-groups/research-entities/submission/item-list-elements/external-source-entry/external-source-entry-list-submission-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/submission/item-list-elements/external-source-entry/external-source-entry-list-submission-element.component.spec.ts @@ -1,5 +1,5 @@ import { ExternalSourceEntryListSubmissionElementComponent } from './external-source-entry-list-submission-element.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { ExternalSourceEntry } from '../../../../../core/shared/external-source-entry.model'; import { TranslateModule } from '@ngx-translate/core'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -22,7 +22,7 @@ describe('ExternalSourceEntryListSubmissionElementComponent', () => { } }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ExternalSourceEntryListSubmissionElementComponent], imports: [TranslateModule.forRoot()], diff --git a/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.spec.ts b/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.spec.ts index 032291b003..ff74c6554f 100644 --- a/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.spec.ts @@ -1,6 +1,6 @@ import { HttpClient } from '@angular/common/http'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { Store } from '@ngrx/store'; @@ -88,7 +88,7 @@ function init() { } describe('OrgUnitSearchResultListSubmissionElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); const mockBitstreamDataService = { getThumbnailFor(item: Item): Observable> { @@ -123,7 +123,7 @@ describe('OrgUnitSearchResultListSubmissionElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(OrgUnitSearchResultListSubmissionElementComponent); personListElementComponent = fixture.componentInstance; diff --git a/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-suggestions/org-unit-input-suggestions.component.spec.ts b/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-suggestions/org-unit-input-suggestions.component.spec.ts index 0bb0cffd39..0981d895ec 100644 --- a/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-suggestions/org-unit-input-suggestions.component.spec.ts +++ b/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-suggestions/org-unit-input-suggestions.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { OrgUnitInputSuggestionsComponent } from './org-unit-input-suggestions.component'; import { FormsModule } from '@angular/forms'; @@ -15,7 +15,7 @@ function init() { } describe('OrgUnitInputSuggestionsComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ declarations: [OrgUnitInputSuggestionsComponent], @@ -30,7 +30,7 @@ describe('OrgUnitInputSuggestionsComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(OrgUnitInputSuggestionsComponent); component = fixture.componentInstance; component.suggestions = suggestions; diff --git a/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.spec.ts b/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.spec.ts index aeb670c054..2c42217a29 100644 --- a/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.spec.ts @@ -1,6 +1,6 @@ import { HttpClient } from '@angular/common/http'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { Store } from '@ngrx/store'; @@ -87,7 +87,7 @@ describe('PersonSearchResultListElementSubmissionComponent', () => { return createSuccessfulRemoteDataObject$(new Bitstream()); } }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ declarations: [PersonSearchResultListSubmissionElementComponent, TruncatePipe], @@ -117,7 +117,7 @@ describe('PersonSearchResultListElementSubmissionComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(PersonSearchResultListSubmissionElementComponent); personListElementComponent = fixture.componentInstance; diff --git a/src/app/entity-groups/research-entities/submission/name-variant-modal/name-variant-modal.component.spec.ts b/src/app/entity-groups/research-entities/submission/name-variant-modal/name-variant-modal.component.spec.ts index e3c73617f1..4a28c203fc 100644 --- a/src/app/entity-groups/research-entities/submission/name-variant-modal/name-variant-modal.component.spec.ts +++ b/src/app/entity-groups/research-entities/submission/name-variant-modal/name-variant-modal.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { NameVariantModalComponent } from './name-variant-modal.component'; import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap'; @@ -14,7 +14,7 @@ describe('NameVariantModalComponent', () => { function init() { modal = jasmine.createSpyObj('modal', ['close', 'dismiss']); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ declarations: [NameVariantModalComponent], diff --git a/src/app/footer/footer.component.spec.ts b/src/app/footer/footer.component.spec.ts index 99c4c70b38..15b289d5fb 100644 --- a/src/app/footer/footer.component.spec.ts +++ b/src/app/footer/footer.component.spec.ts @@ -1,22 +1,14 @@ // ... test imports -import { - async, - ComponentFixture, - inject, - TestBed -} from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; -import { - CUSTOM_ELEMENTS_SCHEMA, - DebugElement -} from '@angular/core'; +import { CUSTOM_ELEMENTS_SCHEMA, DebugElement } from '@angular/core'; import { CommonModule } from '@angular/common'; import { By } from '@angular/platform-browser'; -import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; -import { Store, StoreModule } from '@ngrx/store'; +import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; +import { StoreModule } from '@ngrx/store'; // Load the implementations that should be tested import { FooterComponent } from './footer.component'; @@ -31,8 +23,8 @@ let el: HTMLElement; describe('Footer component', () => { - // async beforeEach - beforeEach(async(() => { + // waitForAsync beforeEach + beforeEach(waitForAsync(() => { return TestBed.configureTestingModule({ imports: [CommonModule, StoreModule.forRoot({}, storeModuleConfig), TranslateModule.forRoot({ loader: { diff --git a/src/app/forgot-password/forgot-password-email/forgot-email.component.spec.ts b/src/app/forgot-password/forgot-password-email/forgot-email.component.spec.ts index d466cbf11b..6ce13c31d3 100644 --- a/src/app/forgot-password/forgot-password-email/forgot-email.component.spec.ts +++ b/src/app/forgot-password/forgot-password-email/forgot-email.component.spec.ts @@ -1,5 +1,5 @@ import { ForgotEmailComponent } from './forgot-email.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { CommonModule } from '@angular/common'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; @@ -9,7 +9,7 @@ describe('ForgotEmailComponent', () => { let comp: ForgotEmailComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [CommonModule, TranslateModule.forRoot(), ReactiveFormsModule], declarations: [ForgotEmailComponent], diff --git a/src/app/forgot-password/forgot-password-form/forgot-password-form.component.spec.ts b/src/app/forgot-password/forgot-password-form/forgot-password-form.component.spec.ts index c9b630daf6..30048acc6d 100644 --- a/src/app/forgot-password/forgot-password-form/forgot-password-form.component.spec.ts +++ b/src/app/forgot-password/forgot-password-form/forgot-password-form.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { of as observableOf } from 'rxjs'; import { RouterStub } from '../../shared/testing/router.stub'; import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub'; @@ -34,7 +34,7 @@ describe('ForgotPasswordFormComponent', () => { token: 'test-token' }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { route = {data: observableOf({registration: registration})}; router = new RouterStub(); diff --git a/src/app/header/header.component.spec.ts b/src/app/header/header.component.spec.ts index 1c3133375a..9bc952cee3 100644 --- a/src/app/header/header.component.spec.ts +++ b/src/app/header/header.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { TranslateModule } from '@ngx-translate/core'; @@ -17,8 +17,8 @@ let fixture: ComponentFixture; describe('HeaderComponent', () => { const menuService = new MenuServiceStub(); - // async beforeEach - beforeEach(async(() => { + // waitForAsync beforeEach + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot(), diff --git a/src/app/info/end-user-agreement/end-user-agreement-content/end-user-agreement-content.component.spec.ts b/src/app/info/end-user-agreement/end-user-agreement-content/end-user-agreement-content.component.spec.ts index d2290cd01c..64a15bfc4e 100644 --- a/src/app/info/end-user-agreement/end-user-agreement-content/end-user-agreement-content.component.spec.ts +++ b/src/app/info/end-user-agreement/end-user-agreement-content/end-user-agreement-content.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { EndUserAgreementContentComponent } from './end-user-agreement-content.component'; import { TranslateModule } from '@ngx-translate/core'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -7,10 +7,10 @@ describe('EndUserAgreementContentComponent', () => { let component: EndUserAgreementContentComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ TranslateModule.forRoot() ], - declarations: [ EndUserAgreementContentComponent ], + imports: [TranslateModule.forRoot()], + declarations: [EndUserAgreementContentComponent], schemas: [NO_ERRORS_SCHEMA] }).compileComponents(); })); diff --git a/src/app/info/end-user-agreement/end-user-agreement.component.spec.ts b/src/app/info/end-user-agreement/end-user-agreement.component.spec.ts index c0957fa7ba..dc4f4cf412 100644 --- a/src/app/info/end-user-agreement/end-user-agreement.component.spec.ts +++ b/src/app/info/end-user-agreement/end-user-agreement.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { EndUserAgreementComponent } from './end-user-agreement.component'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { EndUserAgreementService } from '../../core/end-user-agreement/end-user-agreement.service'; @@ -29,7 +29,7 @@ describe('EndUserAgreementComponent', () => { redirectUrl = 'redirect/url'; endUserAgreementService = jasmine.createSpyObj('endUserAgreementService', { - hasCurrentUserOrCookieAcceptedAgreement : observableOf(false), + hasCurrentUserOrCookieAcceptedAgreement: observableOf(false), setUserAcceptedAgreement: observableOf(true) }); notificationsService = jasmine.createSpyObj('notificationsService', ['success', 'error']); @@ -45,11 +45,11 @@ describe('EndUserAgreementComponent', () => { }) as any; } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ - imports: [ TranslateModule.forRoot() ], - declarations: [ EndUserAgreementComponent ], + imports: [TranslateModule.forRoot()], + declarations: [EndUserAgreementComponent], providers: [ { provide: EndUserAgreementService, useValue: endUserAgreementService }, { provide: NotificationsService, useValue: notificationsService }, diff --git a/src/app/info/privacy/privacy-content/privacy-content.component.spec.ts b/src/app/info/privacy/privacy-content/privacy-content.component.spec.ts index a77e809dc3..682e30273a 100644 --- a/src/app/info/privacy/privacy-content/privacy-content.component.spec.ts +++ b/src/app/info/privacy/privacy-content/privacy-content.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { PrivacyContentComponent } from './privacy-content.component'; import { TranslateModule } from '@ngx-translate/core'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -7,10 +7,10 @@ describe('PrivacyContentComponent', () => { let component: PrivacyContentComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ TranslateModule.forRoot() ], - declarations: [ PrivacyContentComponent ], + imports: [TranslateModule.forRoot()], + declarations: [PrivacyContentComponent], schemas: [NO_ERRORS_SCHEMA] }).compileComponents(); })); diff --git a/src/app/info/privacy/privacy.component.spec.ts b/src/app/info/privacy/privacy.component.spec.ts index a3d47e82f9..6f93adec12 100644 --- a/src/app/info/privacy/privacy.component.spec.ts +++ b/src/app/info/privacy/privacy.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { PrivacyComponent } from './privacy.component'; import { TranslateModule } from '@ngx-translate/core'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -7,10 +7,10 @@ describe('PrivacyComponent', () => { let component: PrivacyComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ TranslateModule.forRoot() ], - declarations: [ PrivacyComponent ], + imports: [TranslateModule.forRoot()], + declarations: [PrivacyComponent], schemas: [NO_ERRORS_SCHEMA] }).compileComponents(); })); diff --git a/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.spec.ts b/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.spec.ts index 7aec26c140..1cc138b53e 100644 --- a/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.spec.ts +++ b/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ExpandableNavbarSectionComponent } from './expandable-navbar-section.component'; import { By } from '@angular/platform-browser'; @@ -16,7 +16,7 @@ describe('ExpandableNavbarSectionComponent', () => { const menuService = new MenuServiceStub(); describe('on larger screens', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [ExpandableNavbarSectionComponent, TestComponent], @@ -93,7 +93,7 @@ describe('ExpandableNavbarSectionComponent', () => { }); describe('on smaller, mobile screens', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [ExpandableNavbarSectionComponent, TestComponent], diff --git a/src/app/navbar/navbar-section/navbar-section.component.spec.ts b/src/app/navbar/navbar-section/navbar-section.component.spec.ts index 90df574021..122bf48636 100644 --- a/src/app/navbar/navbar-section/navbar-section.component.spec.ts +++ b/src/app/navbar/navbar-section/navbar-section.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NavbarSectionComponent } from './navbar-section.component'; import { HostWindowService } from '../../shared/host-window.service'; @@ -14,7 +14,7 @@ describe('NavbarSectionComponent', () => { let fixture: ComponentFixture; const menuService = new MenuServiceStub(); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [NavbarSectionComponent, TestComponent], @@ -44,6 +44,7 @@ describe('NavbarSectionComponent', () => { expect(component).toBeTruthy(); }); }); + // declare a test component @Component({ selector: 'ds-test-cmp', diff --git a/src/app/navbar/navbar.component.spec.ts b/src/app/navbar/navbar.component.spec.ts index 7ad543269a..cbe6738241 100644 --- a/src/app/navbar/navbar.component.spec.ts +++ b/src/app/navbar/navbar.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { of as observableOf } from 'rxjs'; @@ -20,8 +20,8 @@ let fixture: ComponentFixture; describe('NavbarComponent', () => { const menuService = new MenuServiceStub(); - // async beforeEach - beforeEach(async(() => { + // waitForAsync beforeEach + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot(), diff --git a/src/app/process-page/detail/process-detail-field/process-detail-field.component.spec.ts b/src/app/process-page/detail/process-detail-field/process-detail-field.component.spec.ts index 487adb2ac0..57b596b8b6 100644 --- a/src/app/process-page/detail/process-detail-field/process-detail-field.component.spec.ts +++ b/src/app/process-page/detail/process-detail-field/process-detail-field.component.spec.ts @@ -1,5 +1,5 @@ import { ProcessDetailFieldComponent } from './process-detail-field.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { VarDirective } from '../../../shared/utils/var.directive'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; @@ -12,7 +12,7 @@ describe('ProcessDetailFieldComponent', () => { let title; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { title = 'fake.title.message'; TestBed.configureTestingModule({ diff --git a/src/app/process-page/detail/process-detail.component.spec.ts b/src/app/process-page/detail/process-detail.component.spec.ts index fb6f283e2d..4a85c75f81 100644 --- a/src/app/process-page/detail/process-detail.component.spec.ts +++ b/src/app/process-page/detail/process-detail.component.spec.ts @@ -4,7 +4,7 @@ import { BitstreamDataService } from '../../core/data/bitstream-data.service'; import { AuthServiceMock } from '../../shared/mocks/auth.service.mock'; import { ProcessDetailComponent } from './process-detail.component'; import { - async, + waitForAsync, ComponentFixture, discardPeriodicTasks, fakeAsync, @@ -106,7 +106,7 @@ describe('ProcessDetailComponent', () => { }); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ declarations: [ProcessDetailComponent, ProcessDetailFieldComponent, VarDirective, FileSizePipe], diff --git a/src/app/process-page/form/process-form.component.spec.ts b/src/app/process-page/form/process-form.component.spec.ts index 0afdf78201..fce7368d54 100644 --- a/src/app/process-page/form/process-form.component.spec.ts +++ b/src/app/process-page/form/process-form.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; @@ -48,7 +48,7 @@ describe('ProcessFormComponent', () => { }; } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ diff --git a/src/app/process-page/form/process-parameters/parameter-select/parameter-select.component.spec.ts b/src/app/process-page/form/process-parameters/parameter-select/parameter-select.component.spec.ts index 77dcc17926..56fece56b4 100644 --- a/src/app/process-page/form/process-parameters/parameter-select/parameter-select.component.spec.ts +++ b/src/app/process-page/form/process-parameters/parameter-select/parameter-select.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { ParameterSelectComponent } from './parameter-select.component'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -30,7 +30,7 @@ describe('ParameterSelectComponent', () => { ), ]; } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [FormsModule], diff --git a/src/app/process-page/form/process-parameters/parameter-value-input/boolean-value-input/boolean-value-input.component.spec.ts b/src/app/process-page/form/process-parameters/parameter-value-input/boolean-value-input/boolean-value-input.component.spec.ts index 15f09d98f0..38f119ad5b 100644 --- a/src/app/process-page/form/process-parameters/parameter-value-input/boolean-value-input/boolean-value-input.component.spec.ts +++ b/src/app/process-page/form/process-parameters/parameter-value-input/boolean-value-input/boolean-value-input.component.spec.ts @@ -1,14 +1,12 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { BooleanValueInputComponent } from './boolean-value-input.component'; -import { DebugElement } from '@angular/core'; -import { By } from '@angular/platform-browser'; describe('BooleanValueInputComponent', () => { let component: BooleanValueInputComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [BooleanValueInputComponent] }) diff --git a/src/app/process-page/form/process-parameters/parameter-value-input/date-value-input/date-value-input.component.spec.ts b/src/app/process-page/form/process-parameters/parameter-value-input/date-value-input/date-value-input.component.spec.ts index 4f2212eff6..2264a0f331 100644 --- a/src/app/process-page/form/process-parameters/parameter-value-input/date-value-input/date-value-input.component.spec.ts +++ b/src/app/process-page/form/process-parameters/parameter-value-input/date-value-input/date-value-input.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { DateValueInputComponent } from './date-value-input.component'; import { FormsModule } from '@angular/forms'; @@ -10,7 +10,7 @@ describe('DateValueInputComponent', () => { let component: DateValueInputComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ FormsModule, diff --git a/src/app/process-page/form/process-parameters/parameter-value-input/file-value-input/file-value-input.component.spec.ts b/src/app/process-page/form/process-parameters/parameter-value-input/file-value-input/file-value-input.component.spec.ts index 434d5e4edb..07aad6ce4e 100644 --- a/src/app/process-page/form/process-parameters/parameter-value-input/file-value-input/file-value-input.component.spec.ts +++ b/src/app/process-page/form/process-parameters/parameter-value-input/file-value-input/file-value-input.component.spec.ts @@ -1,6 +1,6 @@ -import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import { FormsModule, NgForm, ReactiveFormsModule } from '@angular/forms'; +import { FormsModule } from '@angular/forms'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { By } from '@angular/platform-browser'; import { FileValueInputComponent } from './file-value-input.component'; @@ -13,7 +13,7 @@ describe('FileValueInputComponent', () => { let component: FileValueInputComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ FormsModule, diff --git a/src/app/process-page/form/process-parameters/parameter-value-input/parameter-value-input.component.spec.ts b/src/app/process-page/form/process-parameters/parameter-value-input/parameter-value-input.component.spec.ts index 4a89c4924d..a28e7798c1 100644 --- a/src/app/process-page/form/process-parameters/parameter-value-input/parameter-value-input.component.spec.ts +++ b/src/app/process-page/form/process-parameters/parameter-value-input/parameter-value-input.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { ParameterValueInputComponent } from './parameter-value-input.component'; import { ScriptParameter } from '../../../scripts/script-parameter.model'; @@ -32,7 +32,7 @@ describe('ParameterValueInputComponent', () => { outputParameter = Object.assign(new ScriptParameter(), { type: ScriptParameterType.OUTPUT }); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ diff --git a/src/app/process-page/form/process-parameters/parameter-value-input/string-value-input/string-value-input.component.spec.ts b/src/app/process-page/form/process-parameters/parameter-value-input/string-value-input/string-value-input.component.spec.ts index e702746adc..0cdb0e7a95 100644 --- a/src/app/process-page/form/process-parameters/parameter-value-input/string-value-input/string-value-input.component.spec.ts +++ b/src/app/process-page/form/process-parameters/parameter-value-input/string-value-input/string-value-input.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; import { FormsModule, NgForm } from '@angular/forms'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; @@ -10,7 +10,7 @@ describe('StringValueInputComponent', () => { let component: StringValueInputComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ FormsModule, diff --git a/src/app/process-page/form/process-parameters/process-parameters.component.spec.ts b/src/app/process-page/form/process-parameters/process-parameters.component.spec.ts index f8ba30b228..91bc61e02f 100644 --- a/src/app/process-page/form/process-parameters/process-parameters.component.spec.ts +++ b/src/app/process-page/form/process-parameters/process-parameters.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { ProcessParametersComponent } from './process-parameters.component'; import { ProcessParameter } from '../../processes/process-parameter.model'; @@ -28,7 +28,7 @@ describe('ProcessParametersComponent', () => { ]; } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ diff --git a/src/app/process-page/form/script-help/script-help.component.spec.ts b/src/app/process-page/form/script-help/script-help.component.spec.ts index be005947bc..abfe8f9da1 100644 --- a/src/app/process-page/form/script-help/script-help.component.spec.ts +++ b/src/app/process-page/form/script-help/script-help.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { ScriptHelpComponent } from './script-help.component'; import { ScriptParameter } from '../../scripts/script-parameter.model'; @@ -26,7 +26,7 @@ describe('ScriptHelpComponent', () => { ); script = Object.assign(new Script(), { parameters: [param1, param2] }); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ diff --git a/src/app/process-page/form/scripts-select/scripts-select.component.spec.ts b/src/app/process-page/form/scripts-select/scripts-select.component.spec.ts index 4166978cc0..72dc4c9348 100644 --- a/src/app/process-page/form/scripts-select/scripts-select.component.spec.ts +++ b/src/app/process-page/form/scripts-select/scripts-select.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; @@ -31,7 +31,7 @@ describe('ScriptsSelectComponent', () => { ); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ diff --git a/src/app/process-page/new/new-process.component.spec.ts b/src/app/process-page/new/new-process.component.spec.ts index 89cb18f2e1..48f0f097a9 100644 --- a/src/app/process-page/new/new-process.component.spec.ts +++ b/src/app/process-page/new/new-process.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; @@ -47,7 +47,7 @@ describe('NewProcessComponent', () => { ); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ diff --git a/src/app/process-page/overview/process-overview.component.spec.ts b/src/app/process-page/overview/process-overview.component.spec.ts index bbdd7d7a6c..ffbcbb10cf 100644 --- a/src/app/process-page/overview/process-overview.component.spec.ts +++ b/src/app/process-page/overview/process-overview.component.spec.ts @@ -1,5 +1,5 @@ import { ProcessOverviewComponent } from './process-overview.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { VarDirective } from '../../shared/utils/var.directive'; import { TranslateModule } from '@ngx-translate/core'; import { RouterTestingModule } from '@angular/router/testing'; @@ -71,7 +71,7 @@ describe('ProcessOverviewComponent', () => { }); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ declarations: [ProcessOverviewComponent, VarDirective], diff --git a/src/app/process-page/process-breadcrumbs.service.spec.ts b/src/app/process-page/process-breadcrumbs.service.spec.ts index cfc4a2893d..52b1434c1e 100644 --- a/src/app/process-page/process-breadcrumbs.service.spec.ts +++ b/src/app/process-page/process-breadcrumbs.service.spec.ts @@ -1,4 +1,4 @@ -import { async, TestBed } from '@angular/core/testing'; +import { waitForAsync, TestBed } from '@angular/core/testing'; import { getTestScheduler } from 'jasmine-marbles'; import { ProcessBreadcrumbsService } from './process-breadcrumbs.service'; import { Breadcrumb } from '../breadcrumbs/breadcrumb/breadcrumb.model'; @@ -18,7 +18,7 @@ describe('ProcessBreadcrumbsService', () => { exampleURL = 'example.com'; } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({}).compileComponents(); })); diff --git a/src/app/profile-page/profile-page-metadata-form/profile-page-metadata-form.component.spec.ts b/src/app/profile-page/profile-page-metadata-form/profile-page-metadata-form.component.spec.ts index f331750b26..9c0942d4ff 100644 --- a/src/app/profile-page/profile-page-metadata-form/profile-page-metadata-form.component.spec.ts +++ b/src/app/profile-page/profile-page-metadata-form/profile-page-metadata-form.component.spec.ts @@ -1,5 +1,5 @@ import { ProfilePageMetadataFormComponent } from './profile-page-metadata-form.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { VarDirective } from '../../shared/utils/var.directive'; import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { RouterTestingModule } from '@angular/router/testing'; @@ -61,7 +61,7 @@ describe('ProfilePageMetadataFormComponent', () => { } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ declarations: [ProfilePageMetadataFormComponent, VarDirective], diff --git a/src/app/profile-page/profile-page-security-form/profile-page-security-form.component.spec.ts b/src/app/profile-page/profile-page-security-form/profile-page-security-form.component.spec.ts index ba487f7158..213a83b86e 100644 --- a/src/app/profile-page/profile-page-security-form/profile-page-security-form.component.spec.ts +++ b/src/app/profile-page/profile-page-security-form/profile-page-security-form.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { VarDirective } from '../../shared/utils/var.directive'; import { TranslateModule } from '@ngx-translate/core'; @@ -28,7 +28,7 @@ describe('ProfilePageSecurityFormComponent', () => { }); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ declarations: [ProfilePageSecurityFormComponent, VarDirective], diff --git a/src/app/register-email-form/register-email-form.component.spec.ts b/src/app/register-email-form/register-email-form.component.spec.ts index c44ad64b4e..a415ef4808 100644 --- a/src/app/register-email-form/register-email-form.component.spec.ts +++ b/src/app/register-email-form/register-email-form.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { of as observableOf } from 'rxjs'; import { RestResponse } from '../core/cache/response.models'; import { CommonModule } from '@angular/common'; @@ -24,7 +24,7 @@ describe('RegisterEmailComponent', () => { let epersonRegistrationService: EpersonRegistrationService; let notificationsService; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { router = new RouterStub(); notificationsService = new NotificationsServiceStub(); diff --git a/src/app/register-page/create-profile/confirmed.validator.spec.ts b/src/app/register-page/create-profile/confirmed.validator.spec.ts index 9bbbda9f29..1be6aaf58f 100644 --- a/src/app/register-page/create-profile/confirmed.validator.spec.ts +++ b/src/app/register-page/create-profile/confirmed.validator.spec.ts @@ -1,11 +1,11 @@ import { FormBuilder, FormControl } from '@angular/forms'; -import { async, fakeAsync } from '@angular/core/testing'; +import { fakeAsync, waitForAsync } from '@angular/core/testing'; import { ConfirmedValidator } from './confirmed.validator'; describe('ConfirmedValidator', () => { let passwordForm; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { passwordForm = (new FormBuilder()).group({ password: new FormControl('', {}), diff --git a/src/app/register-page/create-profile/create-profile.component.spec.ts b/src/app/register-page/create-profile/create-profile.component.spec.ts index 59a4d5fd50..6371044229 100644 --- a/src/app/register-page/create-profile/create-profile.component.spec.ts +++ b/src/app/register-page/create-profile/create-profile.component.spec.ts @@ -1,5 +1,5 @@ import { CreateProfileComponent } from './create-profile.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { Registration } from '../../core/shared/registration.model'; import { CommonModule } from '@angular/common'; import { RouterTestingModule } from '@angular/router/testing'; @@ -41,7 +41,7 @@ describe('CreateProfileComponent', () => { let valuesWithAgreement; let epersonWithAgreement: EPerson; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { values = { metadata: { 'eperson.firstname': [ diff --git a/src/app/register-page/register-email/register-email.component.spec.ts b/src/app/register-page/register-email/register-email.component.spec.ts index 74bd247d74..17ef8101ae 100644 --- a/src/app/register-page/register-email/register-email.component.spec.ts +++ b/src/app/register-page/register-email/register-email.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { CommonModule } from '@angular/common'; import { TranslateModule } from '@ngx-translate/core'; import { ReactiveFormsModule } from '@angular/forms'; @@ -10,7 +10,7 @@ describe('RegisterEmailComponent', () => { let comp: RegisterEmailComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [CommonModule, TranslateModule.forRoot(), ReactiveFormsModule], declarations: [RegisterEmailComponent], diff --git a/src/app/search-navbar/search-navbar.component.spec.ts b/src/app/search-navbar/search-navbar.component.spec.ts index 97f73c2b55..9eef81a42e 100644 --- a/src/app/search-navbar/search-navbar.component.spec.ts +++ b/src/app/search-navbar/search-navbar.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; @@ -16,7 +16,7 @@ describe('SearchNavbarComponent', () => { let router: Router; let routerStub; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { mockSearchService = { getSearchLink() { return '/search'; diff --git a/src/app/shared/alert/alert.component.spec.ts b/src/app/shared/alert/alert.component.spec.ts index 51e584c3fa..21e4d197b7 100644 --- a/src/app/shared/alert/alert.component.spec.ts +++ b/src/app/shared/alert/alert.component.spec.ts @@ -1,7 +1,7 @@ import { ChangeDetectorRef, Component, NO_ERRORS_SCHEMA } from '@angular/core'; import { BrowserModule, By } from '@angular/platform-browser'; import { CommonModule } from '@angular/common'; -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TranslateModule } from '@ngx-translate/core'; @@ -16,7 +16,7 @@ describe('AlertComponent test suite', () => { let compAsAny: any; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ BrowserModule, diff --git a/src/app/shared/auth-nav-menu/auth-nav-menu.component.spec.ts b/src/app/shared/auth-nav-menu/auth-nav-menu.component.spec.ts index 633a14b5f8..185cf3e92a 100644 --- a/src/app/shared/auth-nav-menu/auth-nav-menu.component.spec.ts +++ b/src/app/shared/auth-nav-menu/auth-nav-menu.component.spec.ts @@ -1,5 +1,5 @@ import { CUSTOM_ELEMENTS_SCHEMA, DebugElement } from '@angular/core'; -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { Store, StoreModule } from '@ngrx/store'; @@ -55,9 +55,10 @@ describe('AuthNavMenuComponent', () => { userId: EPersonMock.id }; } + describe('when is a not mobile view', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { const window = new HostWindowServiceStub(800); serviceInit(); @@ -251,7 +252,7 @@ describe('AuthNavMenuComponent', () => { }); describe('when is a mobile view', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { const window = new HostWindowServiceStub(300); serviceInit(); diff --git a/src/app/shared/auth-nav-menu/user-menu/user-menu.component.spec.ts b/src/app/shared/auth-nav-menu/user-menu/user-menu.component.spec.ts index b625e28292..c0f5f13e8f 100644 --- a/src/app/shared/auth-nav-menu/user-menu/user-menu.component.spec.ts +++ b/src/app/shared/auth-nav-menu/user-menu/user-menu.component.spec.ts @@ -1,5 +1,5 @@ import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { Store, StoreModule } from '@ngrx/store'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; @@ -8,7 +8,7 @@ import { UserMenuComponent } from './user-menu.component'; import { authReducer, AuthState } from '../../../core/auth/auth.reducer'; import { AuthTokenInfo } from '../../../core/auth/models/auth-token-info.model'; import { EPersonMock } from '../../testing/eperson.mock'; -import { AppState, storeModuleConfig } from '../../../app.reducer'; +import { AppState } from '../../../app.reducer'; import { TranslateLoaderMock } from '../../mocks/translate-loader.mock'; import { cold } from 'jasmine-marbles'; import { By } from '@angular/platform-browser'; @@ -49,7 +49,7 @@ describe('UserMenuComponent', () => { }; } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { serviceInit(); TestBed.configureTestingModule({ imports: [ @@ -159,7 +159,7 @@ describe('UserMenuComponent', () => { expect(deUserMenu).toBeDefined(); }); - it('should display user name and email', () => { + it('should display user name and email', () => { const user = 'User Test (test@test.com)'; const span = deUserMenu.query(By.css('.dropdown-item-text')); expect(span).toBeDefined(); diff --git a/src/app/shared/browse-by/browse-by.component.spec.ts b/src/app/shared/browse-by/browse-by.component.spec.ts index 1e5fa5043a..9f3ceade1a 100644 --- a/src/app/shared/browse-by/browse-by.component.spec.ts +++ b/src/app/shared/browse-by/browse-by.component.spec.ts @@ -1,5 +1,5 @@ import { BrowseByComponent } from './browse-by.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { By } from '@angular/platform-browser'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -45,7 +45,7 @@ describe('BrowseByComponent', () => { ]; const mockItemsRD$ = createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), mockItems)); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ CommonModule, @@ -73,7 +73,7 @@ describe('BrowseByComponent', () => { comp = fixture.componentInstance; }); - it('should display a loading message when objects is empty',() => { + it('should display a loading message when objects is empty', () => { (comp as any).objects = undefined; fixture.detectChanges(); expect(fixture.debugElement.query(By.css('ds-loading'))).toBeDefined(); @@ -98,7 +98,7 @@ describe('BrowseByComponent', () => { comp.paginationConfig = Object.assign(new PaginationComponentOptions(), { id: 'test-pagination', currentPage: 1, - pageSizeOptions: [5,10,15,20], + pageSizeOptions: [5, 10, 15, 20], pageSize: 15 }); comp.sortConfig = Object.assign(new SortOptions('dc.title', SortDirection.ASC)); @@ -112,7 +112,7 @@ describe('BrowseByComponent', () => { fixture.detectChanges(); }); - it('should emit a signal to the EventEmitter',() => { + it('should emit a signal to the EventEmitter', () => { expect(comp.prev.emit).toHaveBeenCalled(); }); }); @@ -124,7 +124,7 @@ describe('BrowseByComponent', () => { fixture.detectChanges(); }); - it('should emit a signal to the EventEmitter',() => { + it('should emit a signal to the EventEmitter', () => { expect(comp.next.emit).toHaveBeenCalled(); }); }); @@ -136,7 +136,7 @@ describe('BrowseByComponent', () => { fixture.detectChanges(); }); - it('should emit a signal to the EventEmitter',() => { + it('should emit a signal to the EventEmitter', () => { expect(comp.pageSizeChange.emit).toHaveBeenCalled(); }); }); @@ -148,7 +148,7 @@ describe('BrowseByComponent', () => { fixture.detectChanges(); }); - it('should emit a signal to the EventEmitter',() => { + it('should emit a signal to the EventEmitter', () => { expect(comp.sortDirectionChange.emit).toHaveBeenCalled(); }); }); diff --git a/src/app/shared/chips/chips.component.spec.ts b/src/app/shared/chips/chips.component.spec.ts index c8330a6bfa..6f9b948002 100644 --- a/src/app/shared/chips/chips.component.spec.ts +++ b/src/app/shared/chips/chips.component.spec.ts @@ -1,6 +1,6 @@ // Load the implementations that should be tested import { ChangeDetectorRef, Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, fakeAsync, inject, TestBed, tick, } from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, inject, TestBed, tick, waitForAsync, } from '@angular/core/testing'; import { Chips } from './models/chips.model'; import { UploaderService } from '../uploader/uploader.service'; @@ -24,13 +24,13 @@ describe('ChipsComponent test suite', () => { let html; let chips: Chips; - // async beforeEach - beforeEach(async(() => { + // waitForAsync beforeEach + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ NgbModule, - SortablejsModule.forRoot({animation: 150}), + SortablejsModule.forRoot({ animation: 150 }), TranslateModule.forRoot() ], declarations: [ diff --git a/src/app/shared/chips/models/chips-item.model.spec.ts b/src/app/shared/chips/models/chips-item.model.spec.ts index d0d3bf22c2..c85ff83c31 100644 --- a/src/app/shared/chips/models/chips-item.model.spec.ts +++ b/src/app/shared/chips/models/chips-item.model.spec.ts @@ -34,14 +34,14 @@ describe('ChipsItem model test suite', () => { }); it('should update icons', () => { - const icons: ChipsItemIcon[] = [{metadata: 'test', visibleWhenAuthorityEmpty: false, style: 'fas fa-plus'}]; + const icons: ChipsItemIcon[] = [{ metadata: 'test', visibleWhenAuthorityEmpty: false, style: 'fas fa-plus' }]; item.updateIcons(icons); expect(item.icons).toEqual(icons); }); it('should return true if has icons', () => { - const icons: ChipsItemIcon[] = [{metadata: 'test', visibleWhenAuthorityEmpty: false, style: 'fas fa-plus'}]; + const icons: ChipsItemIcon[] = [{ metadata: 'test', visibleWhenAuthorityEmpty: false, style: 'fas fa-plus' }]; item.updateIcons(icons); const hasIcons = item.hasIcons(); diff --git a/src/app/shared/collection-dropdown/collection-dropdown.component.spec.ts b/src/app/shared/collection-dropdown/collection-dropdown.component.spec.ts index ec181377b6..f08df65ca4 100644 --- a/src/app/shared/collection-dropdown/collection-dropdown.component.spec.ts +++ b/src/app/shared/collection-dropdown/collection-dropdown.component.spec.ts @@ -103,9 +103,9 @@ const listElementMock = { class CollectionDataServiceMock { getAuthorizedCollection(query: string, options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig[]): Observable>> { return observableOf( - createSuccessfulRemoteDataObject( - buildPaginatedList(new PageInfo(), collections) - ) + createSuccessfulRemoteDataObject( + buildPaginatedList(new PageInfo(), collections) + ) ); } } @@ -141,7 +141,7 @@ describe('CollectionDropdownComponent', () => { ], schemas: [NO_ERRORS_SCHEMA] }) - .compileComponents(); + .compileComponents(); })); beforeEach(() => { diff --git a/src/app/shared/comcol-forms/comcol-form/comcol-form.component.spec.ts b/src/app/shared/comcol-forms/comcol-form/comcol-form.component.spec.ts index cc99c02370..4ee2c1c1b1 100644 --- a/src/app/shared/comcol-forms/comcol-form/comcol-form.component.spec.ts +++ b/src/app/shared/comcol-forms/comcol-form/comcol-form.component.spec.ts @@ -1,6 +1,6 @@ import { Location } from '@angular/common'; import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { FormControl, FormGroup } from '@angular/forms'; import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; @@ -73,7 +73,7 @@ describe('ComColFormComponent', () => { remove: {} }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), RouterTestingModule], declarations: [ComColFormComponent, VarDirective], @@ -324,7 +324,7 @@ describe('ComColFormComponent', () => { comp.formModel = []; comp.dso = dso; (comp as any).type = Community.type; - comp.uploaderComponent = {uploader: {}} as any; + comp.uploaderComponent = { uploader: {} } as any; (comp as any).dsoService = dsoService; fixture.detectChanges(); diff --git a/src/app/shared/comcol-forms/create-comcol-page/create-comcol-page.component.spec.ts b/src/app/shared/comcol-forms/create-comcol-page/create-comcol-page.component.spec.ts index bd0fb3348e..05c3e50e4b 100644 --- a/src/app/shared/comcol-forms/create-comcol-page/create-comcol-page.component.spec.ts +++ b/src/app/shared/comcol-forms/create-comcol-page/create-comcol-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { CommunityDataService } from '../../../core/data/community-data.service'; import { RouteService } from '../../../core/services/route.service'; import { Router } from '@angular/router'; @@ -10,10 +10,7 @@ import { CommonModule } from '@angular/common'; import { RouterTestingModule } from '@angular/router/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { CreateComColPageComponent } from './create-comcol-page.component'; -import { - createFailedRemoteDataObject$, - createSuccessfulRemoteDataObject$ -} from '../../remote-data.utils'; +import { createFailedRemoteDataObject$, createSuccessfulRemoteDataObject$ } from '../../remote-data.utils'; import { ComColDataService } from '../../../core/data/comcol-data.service'; import { NotificationsService } from '../../notifications/notifications.service'; import { NotificationsServiceStub } from '../../testing/notifications-service.stub'; @@ -79,7 +76,9 @@ describe('CreateComColPageComponent', () => { create: (com, uuid?) => createSuccessfulRemoteDataObject$(newCommunity), getLogoEndpoint: () => observableOf(logoEndpoint), findByHref: () => null, - refreshCache: () => {return;} + refreshCache: () => { + return; + } }; routeServiceStub = { @@ -95,7 +94,7 @@ describe('CreateComColPageComponent', () => { } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { initializeVars(); TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], @@ -105,7 +104,7 @@ describe('CreateComColPageComponent', () => { { provide: RouteService, useValue: routeServiceStub }, { provide: Router, useValue: routerStub }, { provide: NotificationsService, useValue: new NotificationsServiceStub() }, - { provide: RequestService, useValue: requestServiceStub} + { provide: RequestService, useValue: requestServiceStub } ], schemas: [NO_ERRORS_SCHEMA] }).compileComponents(); @@ -142,7 +141,8 @@ describe('CreateComColPageComponent', () => { }, queue: [], /* tslint:disable:no-empty */ - uploadAll: () => {} + uploadAll: () => { + } /* tslint:enable:no-empty */ } }; @@ -186,7 +186,8 @@ describe('CreateComColPageComponent', () => { {} ], /* tslint:disable:no-empty */ - uploadAll: () => {} + uploadAll: () => { + } /* tslint:enable:no-empty */ } }; diff --git a/src/app/shared/comcol-forms/delete-comcol-page/delete-comcol-page.component.spec.ts b/src/app/shared/comcol-forms/delete-comcol-page/delete-comcol-page.component.spec.ts index 4d48af4801..6eaf102808 100644 --- a/src/app/shared/comcol-forms/delete-comcol-page/delete-comcol-page.component.spec.ts +++ b/src/app/shared/comcol-forms/delete-comcol-page/delete-comcol-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { CommunityDataService } from '../../../core/data/community-data.service'; import { ActivatedRoute, Router } from '@angular/router'; import { TranslateModule, TranslateService } from '@ngx-translate/core'; @@ -14,10 +14,7 @@ import { NotificationsServiceStub } from '../../testing/notifications-service.st import { RequestService } from '../../../core/data/request.service'; import { getTestScheduler } from 'jasmine-marbles'; import { ComColDataService } from '../../../core/data/comcol-data.service'; -import { - createFailedRemoteDataObject$, - createNoContentRemoteDataObject$ -} from '../../remote-data.utils'; +import { createFailedRemoteDataObject$, createNoContentRemoteDataObject$ } from '../../remote-data.utils'; describe('DeleteComColPageComponent', () => { let comp: DeleteComColPageComponent; @@ -39,6 +36,7 @@ describe('DeleteComColPageComponent', () => { const validUUID = 'valid-uuid'; const invalidUUID = 'invalid-uuid'; const frontendURL = '/testType'; + function initializeVars() { community = Object.assign(new Community(), { uuid: 'a20da287-e174-466a-9926-f66b9300d347', @@ -91,7 +89,7 @@ describe('DeleteComColPageComponent', () => { } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { initializeVars(); TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], @@ -100,8 +98,8 @@ describe('DeleteComColPageComponent', () => { { provide: Router, useValue: routerStub }, { provide: ActivatedRoute, useValue: routeStub }, { provide: NotificationsService, useValue: new NotificationsServiceStub() }, - { provide: TranslateService, useValue: translateServiceStub}, - { provide: RequestService, useValue: requestServiceStub} + { provide: TranslateService, useValue: translateServiceStub }, + { provide: RequestService, useValue: requestServiceStub } ], schemas: [NO_ERRORS_SCHEMA] }).compileComponents(); @@ -147,7 +145,8 @@ describe('DeleteComColPageComponent', () => { }, queue: [], /* tslint:disable:no-empty */ - uploadAll: () => {} + uploadAll: () => { + } /* tslint:enable:no-empty */ } }; diff --git a/src/app/shared/comcol-forms/edit-comcol-page/comcol-metadata/comcol-metadata.component.spec.ts b/src/app/shared/comcol-forms/edit-comcol-page/comcol-metadata/comcol-metadata.component.spec.ts index e865bc8035..9c8d616383 100644 --- a/src/app/shared/comcol-forms/edit-comcol-page/comcol-metadata/comcol-metadata.component.spec.ts +++ b/src/app/shared/comcol-forms/edit-comcol-page/comcol-metadata/comcol-metadata.component.spec.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; @@ -68,7 +68,7 @@ describe('ComColMetadataComponent', () => { } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { initializeVars(); TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], @@ -167,7 +167,8 @@ describe('ComColMetadataComponent', () => { {} ], /* tslint:disable:no-empty */ - uploadAll: () => {} + uploadAll: () => { + } /* tslint:enable:no-empty */ } }; diff --git a/src/app/shared/comcol-forms/edit-comcol-page/comcol-role/comcol-role.component.spec.ts b/src/app/shared/comcol-forms/edit-comcol-page/comcol-role/comcol-role.component.spec.ts index ad3b5eec3f..eb7d9e637f 100644 --- a/src/app/shared/comcol-forms/edit-comcol-page/comcol-role/comcol-role.component.spec.ts +++ b/src/app/shared/comcol-forms/edit-comcol-page/comcol-role/comcol-role.component.spec.ts @@ -8,10 +8,7 @@ import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; import { RequestService } from '../../../../core/data/request.service'; import { of as observableOf } from 'rxjs'; import { RouterTestingModule } from '@angular/router/testing'; -import { - createFailedRemoteDataObject$, - createSuccessfulRemoteDataObject$ -} from '../../../remote-data.utils'; +import { createFailedRemoteDataObject$, createSuccessfulRemoteDataObject$ } from '../../../remote-data.utils'; describe('ComcolRoleComponent', () => { @@ -61,11 +58,11 @@ describe('ComcolRoleComponent', () => { comp = fixture.componentInstance; de = fixture.debugElement; - comcolRole = { + comcolRole = { name: 'test role name', href: 'test role link', }; - comp.comcolRole = comcolRole; + comp.comcolRole = comcolRole; fixture.detectChanges(); }); diff --git a/src/app/shared/comcol-forms/edit-comcol-page/edit-comcol-page.component.spec.ts b/src/app/shared/comcol-forms/edit-comcol-page/edit-comcol-page.component.spec.ts index d1b87db7ae..d13958bb79 100644 --- a/src/app/shared/comcol-forms/edit-comcol-page/edit-comcol-page.component.spec.ts +++ b/src/app/shared/comcol-forms/edit-comcol-page/edit-comcol-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; import { of as observableOf } from 'rxjs'; @@ -59,7 +59,7 @@ describe('EditComColPageComponent', () => { } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { initializeVars(); TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], diff --git a/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts b/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts index e3e0c65920..a06bf4a1e5 100644 --- a/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts +++ b/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { By } from '@angular/platform-browser'; import { ComcolPageHandleComponent } from './comcol-page-handle.component'; @@ -9,12 +9,12 @@ describe('ComcolPageHandleComponent', () => { let component: ComcolPageHandleComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], - declarations: [ ComcolPageHandleComponent ] + declarations: [ComcolPageHandleComponent] }) - .compileComponents(); + .compileComponents(); })); beforeEach(() => { diff --git a/src/app/shared/confirmation-modal/confirmation-modal.component.spec.ts b/src/app/shared/confirmation-modal/confirmation-modal.component.spec.ts index 2aec37e31a..b2ef7cec99 100644 --- a/src/app/shared/confirmation-modal/confirmation-modal.component.spec.ts +++ b/src/app/shared/confirmation-modal/confirmation-modal.component.spec.ts @@ -1,5 +1,5 @@ import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; @@ -12,7 +12,7 @@ describe('ConfirmationModalComponent', () => { const modalStub = jasmine.createSpyObj('modalStub', ['close']); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], declarations: [ConfirmationModalComponent], diff --git a/src/app/shared/ds-select/ds-select.component.spec.ts b/src/app/shared/ds-select/ds-select.component.spec.ts index ddec73348c..fadc854873 100644 --- a/src/app/shared/ds-select/ds-select.component.spec.ts +++ b/src/app/shared/ds-select/ds-select.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { DsSelectComponent } from './ds-select.component'; import { TranslateModule } from '@ngx-translate/core'; @@ -6,7 +6,7 @@ describe('DsSelectComponent', () => { let component: DsSelectComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot(), @@ -15,7 +15,7 @@ describe('DsSelectComponent', () => { DsSelectComponent, ], }) - .compileComponents(); + .compileComponents(); })); beforeEach(() => { diff --git a/src/app/shared/dso-page/dso-page-edit-button/dso-page-edit-button.component.spec.ts b/src/app/shared/dso-page/dso-page-edit-button/dso-page-edit-button.component.spec.ts index c3178ea75e..d3f9ec98ae 100644 --- a/src/app/shared/dso-page/dso-page-edit-button/dso-page-edit-button.component.spec.ts +++ b/src/app/shared/dso-page/dso-page-edit-button/dso-page-edit-button.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { DsoPageEditButtonComponent } from './dso-page-edit-button.component'; import { DSpaceObject } from '../../../core/shared/dspace-object.model'; import { Item } from '../../../core/shared/item.model'; @@ -17,7 +17,7 @@ describe('DsoPageEditButtonComponent', () => { let authorizationService: AuthorizationDataService; let dso: DSpaceObject; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { dso = Object.assign(new Item(), { id: 'test-item', _links: { @@ -28,7 +28,7 @@ describe('DsoPageEditButtonComponent', () => { isAuthorized: observableOf(true) }); TestBed.configureTestingModule({ - declarations: [ DsoPageEditButtonComponent ], + declarations: [DsoPageEditButtonComponent], imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), NgbModule], providers: [ { provide: AuthorizationDataService, useValue: authorizationService } diff --git a/src/app/shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component.spec.ts b/src/app/shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component.spec.ts index 25b7465ada..23b0367b22 100644 --- a/src/app/shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component.spec.ts +++ b/src/app/shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component.spec.ts @@ -1,5 +1,5 @@ import { AuthorizedCollectionSelectorComponent } from './authorized-collection-selector.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { VarDirective } from '../../../utils/var.directive'; import { TranslateModule } from '@ngx-translate/core'; import { RouterTestingModule } from '@angular/router/testing'; @@ -18,7 +18,7 @@ describe('AuthorizedCollectionSelectorComponent', () => { let collectionService; let collection; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { collection = Object.assign(new Collection(), { id: 'authorized-collection' }); diff --git a/src/app/shared/dso-selector/dso-selector/dso-selector.component.spec.ts b/src/app/shared/dso-selector/dso-selector/dso-selector.component.spec.ts index 02fa9a1c13..11418cfcf2 100644 --- a/src/app/shared/dso-selector/dso-selector/dso-selector.component.spec.ts +++ b/src/app/shared/dso-selector/dso-selector/dso-selector.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; import { DSOSelectorComponent } from './dso-selector.component'; @@ -59,7 +59,7 @@ describe('DSOSelectorComponent', () => { }); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], declarations: [DSOSelectorComponent], diff --git a/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.spec.ts index d893e54f6f..a12f2587be 100644 --- a/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.spec.ts @@ -19,9 +19,9 @@ describe('CreateCollectionParentSelectorComponent', () => { community.metadata = { 'dc.title': [ Object.assign(new MetadataValue(), { - value: 'Community title', - language: undefined - })] + value: 'Community title', + language: undefined + })] }; const router = new RouterStub(); const communityRD = createSuccessfulRemoteDataObject(community); diff --git a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.spec.ts index a43ebf7460..2d0a2a25de 100644 --- a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.spec.ts @@ -16,7 +16,12 @@ describe('CreateCommunityParentSelectorComponent', () => { const community = new Community(); community.uuid = '1234-1234-1234-1234'; - community.metadata = { 'dc.title': [Object.assign(new MetadataValue(), { value: 'Community title', language: undefined })] }; + community.metadata = { + 'dc.title': [Object.assign(new MetadataValue(), { + value: 'Community title', + language: undefined + })] + }; const router = new RouterStub(); const communityRD = createSuccessfulRemoteDataObject(community); const modalStub = jasmine.createSpyObj('modalStub', ['close']); diff --git a/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.spec.ts index e48ac587ff..3afb3c5e9a 100644 --- a/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.spec.ts @@ -16,7 +16,12 @@ describe('CreateItemParentSelectorComponent', () => { const collection = new Collection(); collection.uuid = '1234-1234-1234-1234'; - collection.metadata = { 'dc.title': [Object.assign(new MetadataValue(), { value: 'Collection title', language: undefined })] }; + collection.metadata = { + 'dc.title': [Object.assign(new MetadataValue(), { + value: 'Collection title', + language: undefined + })] + }; const router = new RouterStub(); const collectionRD = createSuccessfulRemoteDataObject(collection); const modalStub = jasmine.createSpyObj('modalStub', ['close']); diff --git a/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.spec.ts index 4645de0763..e2dbaaa0ff 100644 --- a/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.spec.ts @@ -1,15 +1,12 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { Component, DebugElement, NO_ERRORS_SCHEMA, OnInit } from '@angular/core'; import { DSpaceObjectType } from '../../../core/shared/dspace-object-type.model'; -import { RemoteData } from '../../../core/data/remote-data'; import { Item } from '../../../core/shared/item.model'; -import { of as observableOf } from 'rxjs'; import { DSOSelectorModalWrapperComponent, SelectorActionType } from './dso-selector-modal-wrapper.component'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ActivatedRoute } from '@angular/router'; import { DSpaceObject } from '../../../core/shared/dspace-object.model'; -import { first } from 'rxjs/operators'; import { By } from '@angular/platform-browser'; import { DSOSelectorComponent } from '../dso-selector/dso-selector.component'; import { MockComponent } from 'ng-mocks'; @@ -33,7 +30,7 @@ describe('DSOSelectorModalWrapperComponent', () => { const itemRD = createSuccessfulRemoteDataObject(item); const modalStub = jasmine.createSpyObj('modalStub', ['close']); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], declarations: [TestComponent, MockComponent(DSOSelectorComponent)], diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.spec.ts index 0f3e9531e0..142f5dcc11 100644 --- a/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.spec.ts @@ -16,7 +16,12 @@ describe('EditCollectionSelectorComponent', () => { const collection = new Collection(); collection.uuid = '1234-1234-1234-1234'; - collection.metadata = { 'dc.title': [Object.assign(new MetadataValue(), { value: 'Collection title', language: undefined })] }; + collection.metadata = { + 'dc.title': [Object.assign(new MetadataValue(), { + value: 'Collection title', + language: undefined + })] + }; const router = new RouterStub(); const collectionRD = createSuccessfulRemoteDataObject(collection); const modalStub = jasmine.createSpyObj('modalStub', ['close']); diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.spec.ts index 1f6cfdf1a4..355ff61e08 100644 --- a/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.spec.ts @@ -16,7 +16,12 @@ describe('EditCommunitySelectorComponent', () => { const community = new Community(); community.uuid = '1234-1234-1234-1234'; - community.metadata = { 'dc.title': [Object.assign(new MetadataValue(), { value: 'Community title', language: undefined })] }; + community.metadata = { + 'dc.title': [Object.assign(new MetadataValue(), { + value: 'Community title', + language: undefined + })] + }; const router = new RouterStub(); const communityRD = createSuccessfulRemoteDataObject(community); const modalStub = jasmine.createSpyObj('modalStub', ['close']); diff --git a/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.spec.ts index 002ad907c2..2f0c4e2651 100644 --- a/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.spec.ts @@ -1,5 +1,5 @@ import { of as observableOf } from 'rxjs'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { DebugElement, NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; @@ -23,7 +23,7 @@ import { ExportMetadataSelectorComponent } from './export-metadata-selector.comp // No way to add entryComponents yet to testbed; alternative implemented; source: https://stackoverflow.com/questions/41689468/how-to-shallow-test-a-component-with-an-entrycomponents @NgModule({ - imports: [ NgbModalModule, + imports: [NgbModalModule, TranslateModule.forRoot({ loader: { provide: TranslateLoader, @@ -36,7 +36,8 @@ import { ExportMetadataSelectorComponent } from './export-metadata-selector.comp providers: [], entryComponents: [ConfirmationModalComponent], }) -class ModelTestModule { } +class ModelTestModule { +} describe('ExportMetadataSelectorComponent', () => { let component: ExportMetadataSelectorComponent; @@ -82,7 +83,7 @@ describe('ExportMetadataSelectorComponent', () => { const itemRD = createSuccessfulRemoteDataObject(mockItem); const modalStub = jasmine.createSpyObj('modalStub', ['close']); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { notificationService = new NotificationsServiceStub(); router = jasmine.createSpyObj('router', { navigateByUrl: jasmine.createSpy('navigateByUrl') diff --git a/src/app/shared/error/error.component.spec.ts b/src/app/shared/error/error.component.spec.ts index 18ee2f24ef..d3e3e80c07 100644 --- a/src/app/shared/error/error.component.spec.ts +++ b/src/app/shared/error/error.component.spec.ts @@ -1,8 +1,8 @@ -import { ComponentFixture, TestBed, async } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { DebugElement } from '@angular/core'; -import { TranslateModule, TranslateLoader, TranslateService } from '@ngx-translate/core'; +import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core'; import { TranslateLoaderMock } from '../mocks/translate-loader.mock'; @@ -15,7 +15,7 @@ describe('ErrorComponent (inline template)', () => { let de: DebugElement; let el: HTMLElement; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot({ diff --git a/src/app/shared/file-download-link/file-download-link.component.spec.ts b/src/app/shared/file-download-link/file-download-link.component.spec.ts index 56702787d3..4f3c17402f 100644 --- a/src/app/shared/file-download-link/file-download-link.component.spec.ts +++ b/src/app/shared/file-download-link/file-download-link.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { FileDownloadLinkComponent } from './file-download-link.component'; import { AuthService } from '../../core/auth/auth.service'; import { FileService } from '../../core/shared/file.service'; @@ -21,7 +21,7 @@ describe('FileDownloadLinkComponent', () => { href = 'test-download-file-link'; } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ declarations: [FileDownloadLinkComponent], diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts index f8070dba54..991aa89105 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { CUSTOM_ELEMENTS_SCHEMA, DebugElement, NgZone, SimpleChange } from '@angular/core'; import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; @@ -39,7 +39,10 @@ import { } from '@ng-dynamic-forms/ui-ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; -import { DsDynamicFormControlContainerComponent, dsDynamicFormControlMapFn } from './ds-dynamic-form-control-container.component'; +import { + DsDynamicFormControlContainerComponent, + dsDynamicFormControlMapFn +} from './ds-dynamic-form-control-container.component'; import { SharedModule } from '../../../shared.module'; import { DynamicDsDatePickerModel } from './models/date-picker/date-picker.model'; import { DynamicRelationGroupModel } from './models/relation-group/dynamic-relation-group.model'; @@ -102,7 +105,13 @@ describe('DsDynamicFormControlContainerComponent test suite', () => { new DynamicSwitchModel({ id: 'switch' }), new DynamicTextAreaModel({ id: 'textarea' }), new DynamicTimePickerModel({ id: 'timepicker' }), - new DynamicOneboxModel({ id: 'typeahead', metadataFields: [], repeatable: false, submissionId: '1234', hasSelectableMetadata: false }), + new DynamicOneboxModel({ + id: 'typeahead', + metadataFields: [], + repeatable: false, + submissionId: '1234', + hasSelectableMetadata: false + }), new DynamicScrollableDropdownModel({ id: 'scrollableDropdown', vocabularyOptions: vocabularyOptions, @@ -111,7 +120,13 @@ describe('DsDynamicFormControlContainerComponent test suite', () => { submissionId: '1234', hasSelectableMetadata: false }), - new DynamicTagModel({ id: 'tag', metadataFields: [], repeatable: false, submissionId: '1234', hasSelectableMetadata: false }), + new DynamicTagModel({ + id: 'tag', + metadataFields: [], + repeatable: false, + submissionId: '1234', + hasSelectableMetadata: false + }), new DynamicListCheckboxGroupModel({ id: 'checkboxList', vocabularyOptions: vocabularyOptions, @@ -136,8 +151,20 @@ describe('DsDynamicFormControlContainerComponent test suite', () => { hasSelectableMetadata: false }), new DynamicDsDatePickerModel({ id: 'datepicker' }), - new DynamicLookupModel({ id: 'lookup', metadataFields: [], repeatable: false, submissionId: '1234', hasSelectableMetadata: false }), - new DynamicLookupNameModel({ id: 'lookupName', metadataFields: [], repeatable: false, submissionId: '1234', hasSelectableMetadata: false}), + new DynamicLookupModel({ + id: 'lookup', + metadataFields: [], + repeatable: false, + submissionId: '1234', + hasSelectableMetadata: false + }), + new DynamicLookupNameModel({ + id: 'lookupName', + metadataFields: [], + repeatable: false, + submissionId: '1234', + hasSelectableMetadata: false + }), new DynamicQualdropModel({ id: 'combobox', readOnly: false, required: false }) ]; const testModel = formModel[8]; @@ -149,7 +176,7 @@ describe('DsDynamicFormControlContainerComponent test suite', () => { const testItem: Item = new Item(); const testWSI: WorkspaceItem = new WorkspaceItem(); testWSI.item = observableOf(createSuccessfulRemoteDataObject(testItem)); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.overrideModule(BrowserDynamicTestingModule, { diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/existing-metadata-list-element/existing-metadata-list-element.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/existing-metadata-list-element/existing-metadata-list-element.component.spec.ts index fa2e95fe1f..c606145c03 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/existing-metadata-list-element/existing-metadata-list-element.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/existing-metadata-list-element/existing-metadata-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ExistingMetadataListElementComponent, @@ -43,13 +43,18 @@ describe('ExistingMetadataListElementComponent', () => { listID = '1234-listID'; submissionItem = Object.assign(new Item(), { uuid: uuid1 }); metadataFields = ['dc.contributor.author']; - relationshipOptions = Object.assign(new RelationshipOptions(), { relationshipType: 'isPublicationOfAuthor', filter: 'test.filter', searchConfiguration: 'personConfiguration', nameVariants: true }); + relationshipOptions = Object.assign(new RelationshipOptions(), { + relationshipType: 'isPublicationOfAuthor', + filter: 'test.filter', + searchConfiguration: 'personConfiguration', + nameVariants: true + }); relatedItem = Object.assign(new Item(), { uuid: uuid2 }); leftItemRD$ = createSuccessfulRemoteDataObject$(relatedItem); rightItemRD$ = createSuccessfulRemoteDataObject$(submissionItem); relatedSearchResult = Object.assign(new ItemSearchResult(), { indexableObject: relatedItem }); relationshipService = { - updatePlace:() => observableOf({}) + updatePlace: () => observableOf({}) } as any; relationship = Object.assign(new Relationship(), { leftItem: leftItemRD$, rightItem: rightItemRD$ }); @@ -57,7 +62,7 @@ describe('ExistingMetadataListElementComponent', () => { reoRel = new ReorderableRelationship(relationship, true, {} as any, {} as any, submissionId); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ declarations: [ExistingMetadataListElementComponent], diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component.spec.ts index bd4bb2c4c6..fddb960515 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ExistingRelationListElementComponent } from './existing-relation-list-element.component'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -41,13 +41,18 @@ describe('ExistingRelationListElementComponent', () => { listID = '1234-listID'; submissionItem = Object.assign(new Item(), { uuid: uuid1 }); metadataFields = ['dc.contributor.author']; - relationshipOptions = Object.assign(new RelationshipOptions(), { relationshipType: 'isPublicationOfAuthor', filter: 'test.filter', searchConfiguration: 'personConfiguration', nameVariants: true }); + relationshipOptions = Object.assign(new RelationshipOptions(), { + relationshipType: 'isPublicationOfAuthor', + filter: 'test.filter', + searchConfiguration: 'personConfiguration', + nameVariants: true + }); relatedItem = Object.assign(new Item(), { uuid: uuid2 }); leftItemRD$ = createSuccessfulRemoteDataObject$(relatedItem); rightItemRD$ = createSuccessfulRemoteDataObject$(submissionItem); relatedSearchResult = Object.assign(new ItemSearchResult(), { indexableObject: relatedItem }); relationshipService = { - updatePlace:() => observableOf({}) + updatePlace: () => observableOf({}) } as any; relationship = Object.assign(new Relationship(), { leftItem: leftItemRD$, rightItem: rightItemRD$ }); @@ -55,7 +60,7 @@ describe('ExistingRelationListElementComponent', () => { reoRel = new ReorderableRelationship(relationship, true, relationshipService, {} as any, submissionId); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ declarations: [ExistingRelationListElementComponent], diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.component.spec.ts index f3ff349980..fd6a96b25b 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.component.spec.ts @@ -10,7 +10,7 @@ import { CustomSwitchComponent } from './custom-switch.component'; describe('CustomSwitchComponent', () => { - const testModel = new DynamicCustomSwitchModel({id: 'switch'}); + const testModel = new DynamicCustomSwitchModel({ id: 'switch' }); const formModel = [testModel]; let formGroup: FormGroup; let fixture: ComponentFixture; diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker-inline/dynamic-date-picker-inline.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker-inline/dynamic-date-picker-inline.component.spec.ts index 04f39215b4..2e5ddf78ea 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker-inline/dynamic-date-picker-inline.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker-inline/dynamic-date-picker-inline.component.spec.ts @@ -1,6 +1,6 @@ -import { TestBed, inject, ComponentFixture, waitForAsync } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { DebugElement } from '@angular/core'; -import { ReactiveFormsModule, FormGroup, FormControl } from '@angular/forms'; +import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { By } from '@angular/platform-browser'; import { TextMaskModule } from 'angular2-text-mask'; @@ -10,98 +10,98 @@ import { DsDatePickerInlineComponent } from './dynamic-date-picker-inline.compon describe('DsDatePickerInlineComponent test suite', () => { - const testModel = new DynamicDatePickerModel({id: 'datepicker'}); - const formModel = [testModel]; - let formGroup: FormGroup; - let fixture: ComponentFixture; - let component: DsDatePickerInlineComponent; - let debugElement: DebugElement; - let testElement: DebugElement; + const testModel = new DynamicDatePickerModel({ id: 'datepicker' }); + const formModel = [testModel]; + let formGroup: FormGroup; + let fixture: ComponentFixture; + let component: DsDatePickerInlineComponent; + let debugElement: DebugElement; + let testElement: DebugElement; - beforeEach(waitForAsync(() => { + beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ + TestBed.configureTestingModule({ - imports: [ - ReactiveFormsModule, - NoopAnimationsModule, - TextMaskModule, - NgbDatepickerModule, - DynamicFormsCoreModule.forRoot() - ], - declarations: [DsDatePickerInlineComponent] + imports: [ + ReactiveFormsModule, + NoopAnimationsModule, + TextMaskModule, + NgbDatepickerModule, + DynamicFormsCoreModule.forRoot() + ], + declarations: [DsDatePickerInlineComponent] - }).compileComponents().then(() => { + }).compileComponents().then(() => { - fixture = TestBed.createComponent(DsDatePickerInlineComponent); + fixture = TestBed.createComponent(DsDatePickerInlineComponent); - component = fixture.componentInstance; - debugElement = fixture.debugElement; - }); - })); - - beforeEach(inject([DynamicFormService], (service: DynamicFormService) => { - - formGroup = service.createFormGroup(formModel); - - component.group = formGroup; - component.model = testModel; - - fixture.detectChanges(); - - testElement = debugElement.query(By.css(`input[id='${testModel.id}']`)); - })); - - it('should initialize correctly', () => { - - expect(component.bindId).toBe(true); - expect(component.control instanceof FormControl).toBe(true); - expect(component.group instanceof FormGroup).toBe(true); - expect(component.model instanceof DynamicDatePickerModel).toBe(true); - - expect(component.blur).toBeDefined(); - expect(component.change).toBeDefined(); - expect(component.focus).toBeDefined(); - - expect(component.onBlur).toBeDefined(); - expect(component.onChange).toBeDefined(); - expect(component.onFocus).toBeDefined(); - - expect(component.hasFocus).toBe(false); - expect(component.isValid).toBe(true); - expect(component.isInvalid).toBe(false); - expect(component.showErrorMessages).toBe(false); + component = fixture.componentInstance; + debugElement = fixture.debugElement; }); + })); - it('should have an input element', () => { + beforeEach(inject([DynamicFormService], (service: DynamicFormService) => { - expect(testElement instanceof DebugElement).toBe(true); - }); + formGroup = service.createFormGroup(formModel); - it('should emit blur event', () => { + component.group = formGroup; + component.model = testModel; - spyOn(component.blur, 'emit'); + fixture.detectChanges(); - component.onBlur(null); + testElement = debugElement.query(By.css(`input[id='${testModel.id}']`)); + })); - expect(component.blur.emit).toHaveBeenCalled(); - }); + it('should initialize correctly', () => { - it('should emit change event', () => { + expect(component.bindId).toBe(true); + expect(component.control instanceof FormControl).toBe(true); + expect(component.group instanceof FormGroup).toBe(true); + expect(component.model instanceof DynamicDatePickerModel).toBe(true); - spyOn(component.change, 'emit'); + expect(component.blur).toBeDefined(); + expect(component.change).toBeDefined(); + expect(component.focus).toBeDefined(); - component.onChange(null); + expect(component.onBlur).toBeDefined(); + expect(component.onChange).toBeDefined(); + expect(component.onFocus).toBeDefined(); - expect(component.change.emit).toHaveBeenCalled(); - }); + expect(component.hasFocus).toBe(false); + expect(component.isValid).toBe(true); + expect(component.isInvalid).toBe(false); + expect(component.showErrorMessages).toBe(false); + }); - it('should emit focus event', () => { + it('should have an input element', () => { - spyOn(component.focus, 'emit'); + expect(testElement instanceof DebugElement).toBe(true); + }); - component.onFocus(null); + it('should emit blur event', () => { - expect(component.focus.emit).toHaveBeenCalled(); - }); + spyOn(component.blur, 'emit'); + + component.onBlur(null); + + expect(component.blur.emit).toHaveBeenCalled(); + }); + + it('should emit change event', () => { + + spyOn(component.change, 'emit'); + + component.onChange(null); + + expect(component.change.emit).toHaveBeenCalled(); + }); + + it('should emit focus event', () => { + + spyOn(component.focus, 'emit'); + + component.onFocus(null); + + expect(component.focus.emit).toHaveBeenCalled(); + }); }); diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.component.spec.ts index ef0d8dc8df..87e49956bb 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.component.spec.ts @@ -39,7 +39,7 @@ describe('DsDatePickerComponent test suite', () => { let dateFixture: ComponentFixture; let html; - // async beforeEach + // waitForAsync beforeEach beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component.spec.ts index 759f22128c..b4a02457dc 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component.spec.ts @@ -74,7 +74,7 @@ describe('DsDynamicListComponent test suite', () => { const vocabularyServiceStub = new VocabularyServiceStub(); - // async beforeEach + // waitForAsync beforeEach beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts index 2b67e648c7..dd97bb74ab 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts @@ -136,7 +136,7 @@ describe('Dynamic Lookup component', () => { let html; let vocabularyServiceStub: VocabularyServiceStub; - // async beforeEach + // waitForAsync beforeEach beforeEach(waitForAsync(() => { vocabularyServiceStub = new VocabularyServiceStub(); TestBed.configureTestingModule({ diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.spec.ts index 57fb803380..6decd5087a 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.spec.ts @@ -114,7 +114,7 @@ describe('DsDynamicOneboxComponent test suite', () => { } }; - // async beforeEach + // waitForAsync beforeEach beforeEach(() => { vocabularyServiceStub = new VocabularyServiceStub(); @@ -154,7 +154,7 @@ describe('DsDynamicOneboxComponent test suite', () => { schemas: [CUSTOM_ELEMENTS_SCHEMA] }).compileComponents(); - }); + }); describe('', () => { // synchronous beforeEach diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.component.spec.ts index d57064ce63..83baeaaeaa 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.component.spec.ts @@ -101,7 +101,7 @@ describe('DsDynamicRelationGroupComponent test suite', () => { let control2: FormControl; let model2: DsDynamicInputModel; - // async beforeEach + // waitForAsync beforeEach beforeEach(waitForAsync(() => { init(); diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.spec.ts index 05b645b556..2121936aa4 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.spec.ts @@ -57,7 +57,7 @@ describe('Dynamic Dynamic Scrollable Dropdown component', () => { const vocabularyServiceStub = new VocabularyServiceStub(); - // async beforeEach + // waitForAsync beforeEach beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.spec.ts index 3f35b42e5f..1d1369f6c3 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.spec.ts @@ -70,7 +70,7 @@ describe('DsDynamicTagComponent test suite', () => { let chips: Chips; let modelValue: any; - // async beforeEach + // waitForAsync beforeEach beforeEach(waitForAsync(() => { const vocabularyServiceStub = new VocabularyServiceStub(); init(); diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.spec.ts index 43d0600a21..2b6f3019f4 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { RouterTestingModule } from '@angular/router/testing'; import { NgZone, NO_ERRORS_SCHEMA } from '@angular/core'; @@ -64,7 +64,12 @@ describe('DsDynamicLookupRelationModalComponent', () => { listID = '6b0c8221-fcb4-47a8-b483-ca32363fffb3'; selection$ = observableOf([searchResult1, searchResult2]); selectableListService = { getSelectableList: () => selection$ }; - relationship = Object.assign(new RelationshipOptions(), { filter: 'filter', relationshipType: 'isAuthorOfPublication', nameVariants: true, searchConfiguration: 'personConfig' }); + relationship = Object.assign(new RelationshipOptions(), { + filter: 'filter', + relationshipType: 'isAuthorOfPublication', + nameVariants: true, + searchConfiguration: 'personConfig' + }); nameVariant = 'Doe, J.'; metadataField = 'dc.contributor.author'; pSearchOptions = new PaginatedSearchOptions({}); @@ -78,7 +83,7 @@ describe('DsDynamicLookupRelationModalComponent', () => { submissionId = '1234'; } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ declarations: [DsDynamicLookupRelationModalComponent], @@ -101,7 +106,8 @@ describe('DsDynamicLookupRelationModalComponent', () => { { provide: Store, useValue: { // tslint:disable-next-line:no-empty - dispatch: () => {} + dispatch: () => { + } } }, { provide: NgZone, useValue: new NgZone({}) }, diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/dynamic-lookup-relation-external-source-tab.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/dynamic-lookup-relation-external-source-tab.component.spec.ts index e8ad12599b..961a826530 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/dynamic-lookup-relation-external-source-tab.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/dynamic-lookup-relation-external-source-tab.component.spec.ts @@ -1,5 +1,5 @@ import { DsDynamicLookupRelationExternalSourceTabComponent } from './dynamic-lookup-relation-external-source-tab.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { VarDirective } from '../../../../../utils/var.directive'; import { TranslateModule } from '@ngx-translate/core'; import { RouterTestingModule } from '@angular/router/testing'; @@ -91,7 +91,7 @@ describe('DsDynamicLookupRelationExternalSourceTabComponent', () => { selectableListService = jasmine.createSpyObj('selectableListService', ['selectSingle']); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ declarations: [DsDynamicLookupRelationExternalSourceTabComponent, VarDirective], diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.spec.ts index ec0f225ae2..d6e36c6825 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.spec.ts @@ -1,5 +1,5 @@ import { ExternalSourceEntryImportModalComponent, ImportType } from './external-source-entry-import-modal.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { RouterTestingModule } from '@angular/router/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -64,7 +64,7 @@ describe('DsDynamicLookupRelationExternalSourceTabComponent', () => { modalStub = jasmine.createSpyObj('modal', ['close']); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ declarations: [ExternalSourceEntryImportModalComponent], diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer.spec.ts index 1ac6cd55d1..cb4128ec46 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer.spec.ts @@ -1,5 +1,4 @@ -import * as deepFreeze from 'deep-freeze'; -import { NameVariantAction, RemoveNameVariantAction, SetNameVariantAction } from './name-variant.actions'; +import { RemoveNameVariantAction, SetNameVariantAction } from './name-variant.actions'; import { Action } from '@ngrx/store'; import { nameVariantReducer } from './name-variant.reducer'; diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.spec.ts index 425915afbf..215049e408 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.spec.ts @@ -52,8 +52,8 @@ describe('RelationshipEffects', () => { testUUID2 = '7f66a4d0-8557-4e77-8b1e-19930895f10a'; leftTypeString = 'Publication'; rightTypeString = 'Person'; - leftType = Object.assign(new ItemType(), {label: leftTypeString}); - rightType = Object.assign(new ItemType(), {label: rightTypeString}); + leftType = Object.assign(new ItemType(), { label: leftTypeString }); + rightType = Object.assign(new ItemType(), { label: rightTypeString }); leftTypeMD = Object.assign(new MetadataValue(), { value: leftTypeString }); rightTypeMD = Object.assign(new MetadataValue(), { value: rightTypeString }); relationshipID = '1234'; @@ -96,6 +96,7 @@ describe('RelationshipEffects', () => { () => observableOf(relationshipType) }; } + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ @@ -104,13 +105,15 @@ describe('RelationshipEffects', () => { provideMockActions(() => actions), { provide: RelationshipTypeService, useValue: mockRelationshipTypeService }, { provide: RelationshipService, useValue: mockRelationshipService }, - { provide: SubmissionObjectDataService, useValue: { - findById: () => createSuccessfulRemoteDataObject$(new WorkspaceItem())}, + { + provide: SubmissionObjectDataService, useValue: { + findById: () => createSuccessfulRemoteDataObject$(new WorkspaceItem()) + }, getHrefByID: () => observableOf('') }, { provide: Store, useValue: jasmine.createSpyObj('store', ['dispatch']) }, - { provide: ObjectCacheService, useValue: {}}, - { provide: RequestService, useValue: {}}, + { provide: ObjectCacheService, useValue: {} }, + { provide: RequestService, useValue: {} }, ], }); })); @@ -248,7 +251,7 @@ describe('RelationshipEffects', () => { actions = hot('a', { a: action }); expectObservable(relationEffects.mapLastActions$).toBe('b', { b: undefined }); flush(); - expect((relationEffects as any).removeRelationship).toHaveBeenCalledWith(leftItem, rightItem, relationshipType.leftwardType, '1234', ); + expect((relationEffects as any).removeRelationship).toHaveBeenCalledWith(leftItem, rightItem, relationshipType.leftwardType, '1234',); }); }); }); diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component.spec.ts index f90cf79e28..700026ba10 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { DsDynamicLookupRelationSearchTabComponent } from './dynamic-lookup-relation-search-tab.component'; import { SearchService } from '../../../../../../core/shared/search/search.service'; @@ -39,7 +39,12 @@ describe('DsDynamicLookupRelationSearchTabComponent', () => { let lookupRelationService; function init() { - relationship = Object.assign(new RelationshipOptions(), { filter: 'filter', relationshipType: 'isAuthorOfPublication', nameVariants: true, searchConfiguration: 'personConfig' }); + relationship = Object.assign(new RelationshipOptions(), { + filter: 'filter', + relationshipType: 'isAuthorOfPublication', + nameVariants: true, + searchConfiguration: 'personConfig' + }); pSearchOptions = new PaginatedSearchOptions({}); item1 = Object.assign(new Item(), { uuid: 'e1c51c69-896d-42dc-8221-1d5f2ad5516e' }); item2 = Object.assign(new Item(), { uuid: 'c8279647-1acc-41ae-b036-951d5f65649b' }); @@ -60,7 +65,7 @@ describe('DsDynamicLookupRelationSearchTabComponent', () => { lookupRelationService.searchConfig = {}; } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ declarations: [DsDynamicLookupRelationSearchTabComponent, VarDirective], diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/selection-tab/dynamic-lookup-relation-selection-tab.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/selection-tab/dynamic-lookup-relation-selection-tab.component.spec.ts index f9ed1f3cb3..05dbdeb2d8 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/selection-tab/dynamic-lookup-relation-selection-tab.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/selection-tab/dynamic-lookup-relation-selection-tab.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { SearchConfigurationService } from '../../../../../../core/shared/search/search-configuration.service'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -12,10 +12,7 @@ import { PaginationComponentOptions } from '../../../../../pagination/pagination import { Router } from '@angular/router'; import { By } from '@angular/platform-browser'; import { RemoteData } from '../../../../../../core/data/remote-data'; -import { - PaginatedList, - buildPaginatedList -} from '../../../../../../core/data/paginated-list.model'; +import { buildPaginatedList, PaginatedList } from '../../../../../../core/data/paginated-list.model'; import { ListableObject } from '../../../../../object-collection/shared/listable-object.model'; import { createSuccessfulRemoteDataObject$ } from '../../../../../remote-data.utils'; @@ -44,7 +41,7 @@ describe('DsDynamicLookupRelationSelectionTabComponent', () => { router = jasmine.createSpyObj('router', ['navigate']); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ declarations: [DsDynamicLookupRelationSelectionTabComponent, VarDirective], diff --git a/src/app/shared/form/builder/form-builder.service.spec.ts b/src/app/shared/form/builder/form-builder.service.spec.ts index 92825b83ea..b81bb3285b 100644 --- a/src/app/shared/form/builder/form-builder.service.spec.ts +++ b/src/app/shared/form/builder/form-builder.service.spec.ts @@ -16,7 +16,8 @@ import { DynamicFileUploadModel, DynamicFormArrayModel, DynamicFormControlModel, - DynamicFormGroupModel, DynamicFormValidationService, + DynamicFormGroupModel, + DynamicFormValidationService, DynamicFormValueControlModel, DynamicInputModel, DynamicRadioGroupModel, @@ -38,9 +39,7 @@ import { DynamicOneboxModel } from './ds-dynamic-form-ui/models/onebox/dynamic-o import { DynamicListRadioGroupModel } from './ds-dynamic-form-ui/models/list/dynamic-list-radio-group.model'; import { VocabularyOptions } from '../../../core/submission/vocabularies/models/vocabulary-options.model'; import { FormFieldModel } from './models/form-field.model'; -import { - SubmissionFormsModel -} from '../../../core/config/models/config-submission-forms.model'; +import { SubmissionFormsModel } from '../../../core/config/models/config-submission-forms.model'; import { FormBuilderService } from './form-builder.service'; import { DynamicRowGroupModel } from './ds-dynamic-form-ui/models/ds-dynamic-row-group-model'; import { DsDynamicInputModel } from './ds-dynamic-form-ui/models/ds-dynamic-input.model'; @@ -193,15 +192,38 @@ describe('FormBuilderService test suite', () => { new DynamicColorPickerModel({ id: 'testColorPicker' }), - new DynamicOneboxModel({ id: 'testOnebox', repeatable: false, metadataFields: [], submissionId: '1234', hasSelectableMetadata: false }), + new DynamicOneboxModel({ + id: 'testOnebox', + repeatable: false, + metadataFields: [], + submissionId: '1234', + hasSelectableMetadata: false + }), - new DynamicScrollableDropdownModel({ id: 'testScrollableDropdown', vocabularyOptions: vocabularyOptions, repeatable: false, metadataFields: [], submissionId: '1234', hasSelectableMetadata: false }), + new DynamicScrollableDropdownModel({ + id: 'testScrollableDropdown', + vocabularyOptions: vocabularyOptions, + repeatable: false, + metadataFields: [], + submissionId: '1234', + hasSelectableMetadata: false + }), - new DynamicTagModel({ id: 'testTag', repeatable: false, metadataFields: [], submissionId: '1234', hasSelectableMetadata: false }), + new DynamicTagModel({ + id: 'testTag', + repeatable: false, + metadataFields: [], + submissionId: '1234', + hasSelectableMetadata: false + }), - new DynamicListCheckboxGroupModel({id: 'testCheckboxList', vocabularyOptions: vocabularyOptions, repeatable: true}), + new DynamicListCheckboxGroupModel({ + id: 'testCheckboxList', + vocabularyOptions: vocabularyOptions, + repeatable: true + }), - new DynamicListRadioGroupModel({id: 'testRadioList', vocabularyOptions: vocabularyOptions, repeatable: false}), + new DynamicListRadioGroupModel({ id: 'testRadioList', vocabularyOptions: vocabularyOptions, repeatable: false }), new DynamicRelationGroupModel({ submissionId, @@ -248,9 +270,21 @@ describe('FormBuilderService test suite', () => { new DynamicDsDatePickerModel({ id: 'testDate' }), - new DynamicLookupModel({ id: 'testLookup', repeatable: false, metadataFields: [], submissionId: '1234', hasSelectableMetadata: true }), + new DynamicLookupModel({ + id: 'testLookup', + repeatable: false, + metadataFields: [], + submissionId: '1234', + hasSelectableMetadata: true + }), - new DynamicLookupNameModel({ id: 'testLookupName', repeatable: false, metadataFields: [], submissionId: '1234', hasSelectableMetadata: true }), + new DynamicLookupNameModel({ + id: 'testLookupName', + repeatable: false, + metadataFields: [], + submissionId: '1234', + hasSelectableMetadata: true + }), new DynamicQualdropModel({ id: 'testCombobox', readOnly: false, required: false }), diff --git a/src/app/shared/form/builder/parsers/disabled-field-parser.spec.ts b/src/app/shared/form/builder/parsers/disabled-field-parser.spec.ts index 346abda49a..e3e86d7051 100644 --- a/src/app/shared/form/builder/parsers/disabled-field-parser.spec.ts +++ b/src/app/shared/form/builder/parsers/disabled-field-parser.spec.ts @@ -1,5 +1,4 @@ import { FormFieldModel } from '../models/form-field.model'; -import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model'; import { ParserOptions } from './parser-options'; import { DisabledFieldParser } from './disabled-field-parser'; import { DynamicDisabledModel } from '../ds-dynamic-form-ui/models/disabled/dynamic-disabled.model'; @@ -54,7 +53,7 @@ describe('DisabledFieldParser test suite', () => { 'test description', ], }; - const expectedValue ='test description'; + const expectedValue = 'test description'; const parser = new DisabledFieldParser(submissionId, field, initFormValues, parserOptions); diff --git a/src/app/shared/form/builder/parsers/name-field-parser.spec.ts b/src/app/shared/form/builder/parsers/name-field-parser.spec.ts index 8342b1fc7e..514585f03f 100644 --- a/src/app/shared/form/builder/parsers/name-field-parser.spec.ts +++ b/src/app/shared/form/builder/parsers/name-field-parser.spec.ts @@ -36,26 +36,26 @@ describe('NameFieldParser test suite', () => { field2 = { hints: 'If the item has any identification numbers or codes associated with↵ it, please enter the types and the actual numbers or codes.', - input: {type: 'onebox'}, + input: { type: 'onebox' }, label: 'Identifiers', languageCodes: [], mandatory: 'false', repeatable: false, selectableMetadata: [ - {metadata: 'dc.identifier.issn', label: 'ISSN'}, - {metadata: 'dc.identifier.other', label: 'Other'}, - {metadata: 'dc.identifier.ismn', label: 'ISMN'}, - {metadata: 'dc.identifier.govdoc', label: 'Gov\'t Doc #'}, - {metadata: 'dc.identifier.uri', label: 'URI'}, - {metadata: 'dc.identifier.isbn', label: 'ISBN'}, - {metadata: 'dc.identifier.doi', label: 'DOI'}, - {metadata: 'dc.identifier.pmid', label: 'PubMed ID'}, - {metadata: 'dc.identifier.arxiv', label: 'arXiv'} + { metadata: 'dc.identifier.issn', label: 'ISSN' }, + { metadata: 'dc.identifier.other', label: 'Other' }, + { metadata: 'dc.identifier.ismn', label: 'ISMN' }, + { metadata: 'dc.identifier.govdoc', label: 'Gov\'t Doc #' }, + { metadata: 'dc.identifier.uri', label: 'URI' }, + { metadata: 'dc.identifier.isbn', label: 'ISBN' }, + { metadata: 'dc.identifier.doi', label: 'DOI' }, + { metadata: 'dc.identifier.pmid', label: 'PubMed ID' }, + { metadata: 'dc.identifier.arxiv', label: 'arXiv' } ] } as FormFieldModel; field3 = { - input: {type: 'onebox'}, + input: { type: 'onebox' }, label: 'Title', mandatory: 'false', repeatable: false, diff --git a/src/app/shared/form/builder/parsers/onebox-field-parser.spec.ts b/src/app/shared/form/builder/parsers/onebox-field-parser.spec.ts index e6a99d8e74..8ecce24194 100644 --- a/src/app/shared/form/builder/parsers/onebox-field-parser.spec.ts +++ b/src/app/shared/form/builder/parsers/onebox-field-parser.spec.ts @@ -20,7 +20,7 @@ describe('OneboxFieldParser test suite', () => { beforeEach(() => { field1 = { - input: {type: 'onebox'}, + input: { type: 'onebox' }, label: 'Title', mandatory: 'false', repeatable: false, @@ -37,26 +37,26 @@ describe('OneboxFieldParser test suite', () => { field2 = { hints: 'If the item has any identification numbers or codes associated with↵ it, please enter the types and the actual numbers or codes.', - input: {type: 'onebox'}, + input: { type: 'onebox' }, label: 'Identifiers', languageCodes: [], mandatory: 'false', repeatable: false, selectableMetadata: [ - {metadata: 'dc.identifier.issn', label: 'ISSN'}, - {metadata: 'dc.identifier.other', label: 'Other'}, - {metadata: 'dc.identifier.ismn', label: 'ISMN'}, - {metadata: 'dc.identifier.govdoc', label: 'Gov\'t Doc #'}, - {metadata: 'dc.identifier.uri', label: 'URI'}, - {metadata: 'dc.identifier.isbn', label: 'ISBN'}, - {metadata: 'dc.identifier.doi', label: 'DOI'}, - {metadata: 'dc.identifier.pmid', label: 'PubMed ID'}, - {metadata: 'dc.identifier.arxiv', label: 'arXiv'} + { metadata: 'dc.identifier.issn', label: 'ISSN' }, + { metadata: 'dc.identifier.other', label: 'Other' }, + { metadata: 'dc.identifier.ismn', label: 'ISMN' }, + { metadata: 'dc.identifier.govdoc', label: 'Gov\'t Doc #' }, + { metadata: 'dc.identifier.uri', label: 'URI' }, + { metadata: 'dc.identifier.isbn', label: 'ISBN' }, + { metadata: 'dc.identifier.doi', label: 'DOI' }, + { metadata: 'dc.identifier.pmid', label: 'PubMed ID' }, + { metadata: 'dc.identifier.arxiv', label: 'arXiv' } ] } as FormFieldModel; field3 = { - input: {type: 'onebox'}, + input: { type: 'onebox' }, label: 'Title', mandatory: 'false', repeatable: false, diff --git a/src/app/shared/form/builder/parsers/row-parser.spec.ts b/src/app/shared/form/builder/parsers/row-parser.spec.ts index 63f343e60d..e612534d55 100644 --- a/src/app/shared/form/builder/parsers/row-parser.spec.ts +++ b/src/app/shared/form/builder/parsers/row-parser.spec.ts @@ -27,7 +27,7 @@ describe('RowParser test suite', () => { row1 = { fields: [ { - input: {type: 'lookup'}, + input: { type: 'lookup' }, label: 'Journal', mandatory: 'false', repeatable: false, @@ -42,7 +42,7 @@ describe('RowParser test suite', () => { languageCodes: [] } as FormFieldModel, { - input: {type: 'onebox'}, + input: { type: 'onebox' }, label: 'Issue', mandatory: 'false', repeatable: false, @@ -55,7 +55,7 @@ describe('RowParser test suite', () => { languageCodes: [] } as FormFieldModel, { - input: {type: 'name'}, + input: { type: 'name' }, label: 'Name', mandatory: 'false', repeatable: false, @@ -95,7 +95,7 @@ describe('RowParser test suite', () => { row3 = { fields: [ { - input: {type: 'onebox'}, + input: { type: 'onebox' }, label: 'Title', mandatory: 'false', repeatable: false, @@ -110,7 +110,7 @@ describe('RowParser test suite', () => { languageCodes: [] } as FormFieldModel, { - input: {type: 'onebox'}, + input: { type: 'onebox' }, label: 'Other title', mandatory: 'false', repeatable: false, @@ -148,7 +148,7 @@ describe('RowParser test suite', () => { languageCodes: [] } as FormFieldModel, { - input: {type: 'series'}, + input: { type: 'series' }, label: 'Series/Report No.', mandatory: 'false', repeatable: false, diff --git a/src/app/shared/form/builder/parsers/series-field-parser.spec.ts b/src/app/shared/form/builder/parsers/series-field-parser.spec.ts index 229ca989d3..b044f43833 100644 --- a/src/app/shared/form/builder/parsers/series-field-parser.spec.ts +++ b/src/app/shared/form/builder/parsers/series-field-parser.spec.ts @@ -17,7 +17,7 @@ describe('SeriesFieldParser test suite', () => { beforeEach(() => { field = { - input: {type: 'series'}, + input: { type: 'series' }, label: 'Series/Report No.', mandatory: 'false', repeatable: false, diff --git a/src/app/shared/form/builder/parsers/textarea-field-parser.spec.ts b/src/app/shared/form/builder/parsers/textarea-field-parser.spec.ts index 84acc9f239..a81907aa13 100644 --- a/src/app/shared/form/builder/parsers/textarea-field-parser.spec.ts +++ b/src/app/shared/form/builder/parsers/textarea-field-parser.spec.ts @@ -54,7 +54,7 @@ describe('TextareaFieldParser test suite', () => { new FormFieldMetadataValueObject('test description'), ], }; - const expectedValue ='test description'; + const expectedValue = 'test description'; const parser = new TextareaFieldParser(submissionId, field, initFormValues, parserOptions); diff --git a/src/app/shared/form/form.component.spec.ts b/src/app/shared/form/form.component.spec.ts index 66bd093c6a..aa004b3f87 100644 --- a/src/app/shared/form/form.component.spec.ts +++ b/src/app/shared/form/form.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectorRef, Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, inject, TestBed, } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync, } from '@angular/core/testing'; import { CommonModule } from '@angular/common'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; @@ -132,8 +132,8 @@ describe('FormComponent test suite', () => { let testFixture: ComponentFixture; let formFixture: ComponentFixture; - // async beforeEach - beforeEach(async(() => { + // waitForAsync beforeEach + beforeEach(waitForAsync(() => { init(); /* TODO make sure these files use mocks instead of real services/components https://github.com/DSpace/dspace-angular/issues/281 */ TestBed.configureTestingModule({ diff --git a/src/app/shared/form/form.reducer.spec.ts b/src/app/shared/form/form.reducer.spec.ts index 5547eee7a4..dc85b3e0c3 100644 --- a/src/app/shared/form/form.reducer.spec.ts +++ b/src/app/shared/form/form.reducer.spec.ts @@ -1,12 +1,12 @@ import { formReducer } from './form.reducer'; import { FormAddError, + FormAddTouchedAction, FormChangeAction, FormClearErrorsAction, FormInitAction, FormRemoveAction, FormRemoveErrorAction, - FormAddTouchedAction, FormStatusChangeAction } from './form.actions'; diff --git a/src/app/shared/form/form.service.spec.ts b/src/app/shared/form/form.service.spec.ts index 382326fbf8..6370a5f4ba 100644 --- a/src/app/shared/form/form.service.spec.ts +++ b/src/app/shared/form/form.service.spec.ts @@ -1,12 +1,8 @@ import { Store, StoreModule } from '@ngrx/store'; -import { async, inject, TestBed } from '@angular/core/testing'; +import { inject, TestBed, waitForAsync } from '@angular/core/testing'; import { AbstractControl, FormControl, FormGroup, Validators } from '@angular/forms'; -import { - DynamicFormControlModel, - DynamicFormGroupModel, - DynamicInputModel -} from '@ng-dynamic-forms/core'; +import { DynamicFormControlModel, DynamicFormGroupModel, DynamicInputModel } from '@ng-dynamic-forms/core'; import { FormService } from './form.service'; import { FormBuilderService } from './builder/form-builder.service'; @@ -89,7 +85,7 @@ describe('FormService test suite', () => { } }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ StoreModule.forRoot({ formReducer }, { diff --git a/src/app/shared/host-window.service.spec.ts b/src/app/shared/host-window.service.spec.ts index fef33f9b7b..bbb9b3eece 100644 --- a/src/app/shared/host-window.service.spec.ts +++ b/src/app/shared/host-window.service.spec.ts @@ -5,9 +5,11 @@ import { AppState } from '../app.reducer'; import { HostWindowService, WidthCategory } from './host-window.service'; import { CSSVariableServiceStub } from './testing/css-variable-service.stub'; + describe('HostWindowService', () => { let service: HostWindowService; let store: Store; + enum GridBreakpoint { SM_MIN = 576, MD_MIN = 768, @@ -197,7 +199,7 @@ describe('HostWindowService', () => { describe('widthCategory', () => { beforeEach(() => { - service = new HostWindowService({} as Store, new CSSVariableServiceStub() as any); + service = new HostWindowService({} as Store, new CSSVariableServiceStub() as any); }); it('should call getWithObs to get the current width', () => { diff --git a/src/app/shared/hover-class.directive.spec.ts b/src/app/shared/hover-class.directive.spec.ts index 9c593f27c8..9c222dfe3a 100644 --- a/src/app/shared/hover-class.directive.spec.ts +++ b/src/app/shared/hover-class.directive.spec.ts @@ -6,7 +6,8 @@ import { By } from '@angular/platform-browser'; @Component({ template: `
` }) -class TestComponent { } +class TestComponent { +} describe('HoverClassDirective', () => { let component: TestComponent; diff --git a/src/app/shared/input-suggestions/dso-input-suggestions/dso-input-suggestions.component.spec.ts b/src/app/shared/input-suggestions/dso-input-suggestions/dso-input-suggestions.component.spec.ts index 4229060e86..4c979a1d4c 100644 --- a/src/app/shared/input-suggestions/dso-input-suggestions/dso-input-suggestions.component.spec.ts +++ b/src/app/shared/input-suggestions/dso-input-suggestions/dso-input-suggestions.component.spec.ts @@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, DebugElement, NO_ERRORS_SCHEMA } from '@angula import { TranslateModule } from '@ngx-translate/core'; import { By } from '@angular/platform-browser'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; @@ -33,14 +33,14 @@ describe('DsoInputSuggestionsComponent', () => { const suggestions = [dso1, dso2, dso3]; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), NoopAnimationsModule, FormsModule], declarations: [DsoInputSuggestionsComponent], providers: [], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(DsoInputSuggestionsComponent, { - set: {changeDetection: ChangeDetectionStrategy.Default} + set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); diff --git a/src/app/shared/input-suggestions/filter-suggestions/filter-input-suggestions.component.spec.ts b/src/app/shared/input-suggestions/filter-suggestions/filter-input-suggestions.component.spec.ts index 51664039f7..3c55715b06 100644 --- a/src/app/shared/input-suggestions/filter-suggestions/filter-input-suggestions.component.spec.ts +++ b/src/app/shared/input-suggestions/filter-suggestions/filter-input-suggestions.component.spec.ts @@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, DebugElement, NO_ERRORS_SCHEMA } from '@angula import { TranslateModule } from '@ngx-translate/core'; import { By } from '@angular/platform-browser'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; @@ -19,7 +19,7 @@ describe('FilterInputSuggestionsComponent', () => { value: 'suggestion dos' }, { displayValue: 'suggestion tres', value: 'suggestion tres' }]; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), NoopAnimationsModule, FormsModule], declarations: [FilterInputSuggestionsComponent], diff --git a/src/app/shared/input-suggestions/input-suggestions.component.spec.ts b/src/app/shared/input-suggestions/input-suggestions.component.spec.ts index 95f03106b7..9793844e89 100644 --- a/src/app/shared/input-suggestions/input-suggestions.component.spec.ts +++ b/src/app/shared/input-suggestions/input-suggestions.component.spec.ts @@ -3,7 +3,7 @@ import { ChangeDetectionStrategy, DebugElement, NO_ERRORS_SCHEMA } from '@angula import { TranslateModule } from '@ngx-translate/core'; import { InputSuggestionsComponent } from './input-suggestions.component'; import { By } from '@angular/platform-browser'; -import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; @@ -16,8 +16,11 @@ describe('InputSuggestionsComponent', () => { let el: HTMLElement; let suggestions; - beforeEach(async(() => { - suggestions = [{displayValue: 'suggestion uno', value: 'suggestion uno'}, {displayValue: 'suggestion dos', value: 'suggestion dos'}, {displayValue: 'suggestion tres', value: 'suggestion tres'}]; + beforeEach(waitForAsync(() => { + suggestions = [{ displayValue: 'suggestion uno', value: 'suggestion uno' }, { + displayValue: 'suggestion dos', + value: 'suggestion dos' + }, { displayValue: 'suggestion tres', value: 'suggestion tres' }]; TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), NoopAnimationsModule, FormsModule], @@ -213,7 +216,7 @@ describe('InputSuggestionsComponent', () => { describe('when onKeydown is triggered with the Enter key', () => { beforeEach(() => { spyOn(comp.queryInput.nativeElement, 'focus'); - comp.onKeydown(new KeyboardEvent('keydown', {key: 'Enter'})); + comp.onKeydown(new KeyboardEvent('keydown', { key: 'Enter' })); fixture.detectChanges(); }); @@ -226,7 +229,7 @@ describe('InputSuggestionsComponent', () => { describe('when onKeydown is triggered with the any other (not-Enter) key', () => { beforeEach(() => { spyOn(comp.queryInput.nativeElement, 'focus'); - comp.onKeydown(new KeyboardEvent('keydown', {key: 'Shift'})); + comp.onKeydown(new KeyboardEvent('keydown', { key: 'Shift' })); fixture.detectChanges(); }); @@ -298,7 +301,7 @@ describe('InputSuggestionsComponent', () => { beforeEach(() => { spyOn(comp, 'onClickSuggestion'); const clickedLink = de.query(By.css('.dropdown-list > div:nth-child(' + (clickedIndex + 1) + ') a')); - clickedLink.triggerEventHandler('click', {} ); + clickedLink.triggerEventHandler('click', {}); fixture.detectChanges(); }); it('should call onClickSuggestion() with the suggestion as a parameter', () => { diff --git a/src/app/shared/input-suggestions/validation-suggestions/validation-suggestions.component.spec.ts b/src/app/shared/input-suggestions/validation-suggestions/validation-suggestions.component.spec.ts index 82e838effc..388ed40cfe 100644 --- a/src/app/shared/input-suggestions/validation-suggestions/validation-suggestions.component.spec.ts +++ b/src/app/shared/input-suggestions/validation-suggestions/validation-suggestions.component.spec.ts @@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, DebugElement, NO_ERRORS_SCHEMA } from '@angula import { TranslateModule } from '@ngx-translate/core'; import { By } from '@angular/platform-browser'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; @@ -21,7 +21,7 @@ describe('ValidationSuggestionsComponent', () => { value: 'suggestion dos' }, { displayValue: 'suggestion tres', value: 'suggestion tres' }]; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), NoopAnimationsModule, FormsModule, ReactiveFormsModule], declarations: [ValidationSuggestionsComponent], diff --git a/src/app/shared/item/item-alerts/item-alerts.component.spec.ts b/src/app/shared/item/item-alerts/item-alerts.component.spec.ts index 983283b036..fed81199fd 100644 --- a/src/app/shared/item/item-alerts/item-alerts.component.spec.ts +++ b/src/app/shared/item/item-alerts/item-alerts.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ItemAlertsComponent } from './item-alerts.component'; import { TranslateModule } from '@ngx-translate/core'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -10,13 +10,13 @@ describe('ItemAlertsComponent', () => { let fixture: ComponentFixture; let item: Item; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ItemAlertsComponent], imports: [TranslateModule.forRoot()], schemas: [NO_ERRORS_SCHEMA] }) - .compileComponents(); + .compileComponents(); })); beforeEach(() => { diff --git a/src/app/shared/item/item-versions/item-versions.component.spec.ts b/src/app/shared/item/item-versions/item-versions.component.spec.ts index 3ffbb3824a..f35ec1993d 100644 --- a/src/app/shared/item/item-versions/item-versions.component.spec.ts +++ b/src/app/shared/item/item-versions/item-versions.component.spec.ts @@ -1,5 +1,5 @@ import { ItemVersionsComponent } from './item-versions.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { VarDirective } from '../../utils/var.directive'; import { TranslateModule } from '@ngx-translate/core'; import { RouterTestingModule } from '@angular/router/testing'; @@ -52,7 +52,7 @@ describe('ItemVersionsComponent', () => { getVersions: createSuccessfulRemoteDataObject$(createPaginatedList(versions)) }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ItemVersionsComponent, VarDirective], imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([])], diff --git a/src/app/shared/item/item-versions/notice/item-versions-notice.component.spec.ts b/src/app/shared/item/item-versions/notice/item-versions-notice.component.spec.ts index f00dee2853..f2184b136a 100644 --- a/src/app/shared/item/item-versions/notice/item-versions-notice.component.spec.ts +++ b/src/app/shared/item/item-versions/notice/item-versions-notice.component.spec.ts @@ -1,5 +1,5 @@ import { ItemVersionsNoticeComponent } from './item-versions-notice.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { RouterTestingModule } from '@angular/router/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -52,7 +52,7 @@ describe('ItemVersionsNoticeComponent', () => { getVersions: createSuccessfulRemoteDataObject$(createPaginatedList(versions)) }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ItemVersionsNoticeComponent], imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([])], diff --git a/src/app/shared/lang-switch/lang-switch.component.spec.ts b/src/app/shared/lang-switch/lang-switch.component.spec.ts index c3e05cf4ad..a110893904 100644 --- a/src/app/shared/lang-switch/lang-switch.component.spec.ts +++ b/src/app/shared/lang-switch/lang-switch.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; @@ -52,7 +52,7 @@ describe('LangSwitchComponent', () => { let translate: TranslateService; let http: HttpTestingController; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { const mockConfig = { languages: [{ @@ -98,12 +98,12 @@ describe('LangSwitchComponent', () => { expect(component).toBeDefined(); }); - it('should identify English as the label for the current active language in the component', async(() => { + it('should identify English as the label for the current active language in the component', waitForAsync(() => { fixture.detectChanges(); expect(component.currentLangLabel()).toEqual('English'); })); - it('should be initialized with more than one language active', async(() => { + it('should be initialized with more than one language active', waitForAsync(() => { fixture.detectChanges(); expect(component.moreThanOneLanguage).toBeTruthy(); })); @@ -138,7 +138,7 @@ describe('LangSwitchComponent', () => { let translate: TranslateService; let http: HttpTestingController; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { const mockConfig = { languages: [{ diff --git a/src/app/shared/loading/loading.component.spec.ts b/src/app/shared/loading/loading.component.spec.ts index 52ffad7c50..d564d43dc0 100644 --- a/src/app/shared/loading/loading.component.spec.ts +++ b/src/app/shared/loading/loading.component.spec.ts @@ -1,8 +1,8 @@ -import { ComponentFixture, TestBed, async } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { DebugElement } from '@angular/core'; -import { TranslateModule, TranslateLoader, TranslateService } from '@ngx-translate/core'; +import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core'; import { TranslateLoaderMock } from '../mocks/translate-loader.mock'; @@ -15,7 +15,7 @@ describe('LoadingComponent (inline template)', () => { let de: DebugElement; let el: HTMLElement; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot({ diff --git a/src/app/shared/log-in/container/log-in-container.component.spec.ts b/src/app/shared/log-in/container/log-in-container.component.spec.ts index 91fe94371a..29598e422e 100644 --- a/src/app/shared/log-in/container/log-in-container.component.spec.ts +++ b/src/app/shared/log-in/container/log-in-container.component.spec.ts @@ -41,7 +41,7 @@ describe('LogInContainerComponent', () => { TestComponent ], providers: [ - {provide: AuthService, useClass: AuthServiceStub}, + { provide: AuthService, useClass: AuthServiceStub }, { provide: HardRedirectService, useValue: hardRedirectService }, LogInContainerComponent ], diff --git a/src/app/shared/log-in/log-in.component.spec.ts b/src/app/shared/log-in/log-in.component.spec.ts index fbe5cddc40..0a13e8b701 100644 --- a/src/app/shared/log-in/log-in.component.spec.ts +++ b/src/app/shared/log-in/log-in.component.spec.ts @@ -1,5 +1,5 @@ import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { StoreModule } from '@ngrx/store'; @@ -40,7 +40,7 @@ describe('LogInComponent', () => { let authorizationService: AuthorizationDataService; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { hardRedirectService = jasmine.createSpyObj('hardRedirectService', { redirect: {}, getCurrentRoute: {} diff --git a/src/app/shared/log-in/methods/password/log-in-password.component.spec.ts b/src/app/shared/log-in/methods/password/log-in-password.component.spec.ts index 0ea3257af8..355d328f3f 100644 --- a/src/app/shared/log-in/methods/password/log-in-password.component.spec.ts +++ b/src/app/shared/log-in/methods/password/log-in-password.component.spec.ts @@ -74,7 +74,7 @@ describe('LogInPasswordComponent', () => { })); - beforeEach( () => { + beforeEach(() => { // create component and test fixture fixture = TestBed.createComponent(LogInPasswordComponent); diff --git a/src/app/shared/log-out/log-out.component.spec.ts b/src/app/shared/log-out/log-out.component.spec.ts index fcdb50f17c..f15203ed8b 100644 --- a/src/app/shared/log-out/log-out.component.spec.ts +++ b/src/app/shared/log-out/log-out.component.spec.ts @@ -1,5 +1,5 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { Store, StoreModule } from '@ngrx/store'; @@ -9,7 +9,7 @@ import { EPersonMock } from '../testing/eperson.mock'; import { EPerson } from '../../core/eperson/models/eperson.model'; import { TranslateModule } from '@ngx-translate/core'; import { Router } from '@angular/router'; -import { AppState, storeModuleConfig } from '../../app.reducer'; +import { AppState } from '../../app.reducer'; import { LogOutComponent } from './log-out.component'; import { RouterStub } from '../testing/router.stub'; @@ -31,7 +31,7 @@ describe('LogOutComponent', () => { user = EPersonMock; }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { // refine the test module by declaring the test component TestBed.configureTestingModule({ imports: [ @@ -49,7 +49,7 @@ describe('LogOutComponent', () => { LogOutComponent ], providers: [ - {provide: Router, useValue: routerStub}, + { provide: Router, useValue: routerStub }, ], schemas: [ CUSTOM_ELEMENTS_SCHEMA diff --git a/src/app/shared/menu/menu-item/link-menu-item.component.spec.ts b/src/app/shared/menu/menu-item/link-menu-item.component.spec.ts index d20773165f..43e17b8f03 100644 --- a/src/app/shared/menu/menu-item/link-menu-item.component.spec.ts +++ b/src/app/shared/menu/menu-item/link-menu-item.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; @@ -17,7 +17,8 @@ describe('LinkMenuItemComponent', () => { text = 'HELLO'; link = 'http://google.com'; } - beforeEach(async(() => { + + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], diff --git a/src/app/shared/menu/menu-item/onclick-menu-item.component.spec.ts b/src/app/shared/menu/menu-item/onclick-menu-item.component.spec.ts index dbe6fdab6a..c36b46a20d 100644 --- a/src/app/shared/menu/menu-item/onclick-menu-item.component.spec.ts +++ b/src/app/shared/menu/menu-item/onclick-menu-item.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; @@ -15,7 +15,7 @@ describe('OnClickMenuItemComponent', () => { }; const item = Object.assign(new OnClickMenuItemModel(), { text, function: func }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], declarations: [OnClickMenuItemComponent], diff --git a/src/app/shared/menu/menu-item/text-menu-item.component.spec.ts b/src/app/shared/menu/menu-item/text-menu-item.component.spec.ts index 46c9b21bd9..a0c159af23 100644 --- a/src/app/shared/menu/menu-item/text-menu-item.component.spec.ts +++ b/src/app/shared/menu/menu-item/text-menu-item.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TextMenuItemComponent } from './text-menu-item.component'; import { TranslateModule } from '@ngx-translate/core'; import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; @@ -9,14 +9,14 @@ describe('TextMenuItemComponent', () => { let fixture: ComponentFixture; let debugElement: DebugElement; const text = 'HELLO'; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], declarations: [TextMenuItemComponent], providers: [ { provide: 'itemModelProvider', useValue: { text: text } }, ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }) .compileComponents(); })); diff --git a/src/app/shared/menu/menu-section/menu-section.component.spec.ts b/src/app/shared/menu/menu-section/menu-section.component.spec.ts index 18b607df0b..27d9821d52 100644 --- a/src/app/shared/menu/menu-section/menu-section.component.spec.ts +++ b/src/app/shared/menu/menu-section/menu-section.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TranslateModule } from '@ngx-translate/core'; import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core'; @@ -15,7 +15,7 @@ describe('MenuSectionComponent', () => { let menuService: MenuService; let dummySection; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { dummySection = { id: 'section', visible: true, diff --git a/src/app/shared/menu/menu.component.spec.ts b/src/app/shared/menu/menu.component.spec.ts index cec09bc040..883969137b 100644 --- a/src/app/shared/menu/menu.component.spec.ts +++ b/src/app/shared/menu/menu.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TranslateModule } from '@ngx-translate/core'; import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core'; @@ -19,7 +19,7 @@ describe('MenuComponent', () => { const mockMenuID = 'mock-menuID' as MenuID; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), NoopAnimationsModule, RouterTestingModule], declarations: [MenuComponent], diff --git a/src/app/shared/menu/menu.service.spec.ts b/src/app/shared/menu/menu.service.spec.ts index cb54e05d06..819ccf5e9f 100644 --- a/src/app/shared/menu/menu.service.spec.ts +++ b/src/app/shared/menu/menu.service.spec.ts @@ -80,7 +80,7 @@ describe('MenuService', () => { initialState = { menus: { - 'admin-sidebar' : fakeMenu + 'admin-sidebar': fakeMenu } }; @@ -144,7 +144,7 @@ describe('MenuService', () => { describe('when the subsection list is not empty', () => { it('should return the MenuSections with the given parentID', () => { - const result = service.getSubSectionsByParentID(MenuID.ADMIN,'section'); + const result = service.getSubSectionsByParentID(MenuID.ADMIN, 'section'); const expected = cold('b', { b: [subSection4] }); @@ -179,14 +179,14 @@ describe('MenuService', () => { describe('when the subsection list is empty', () => { beforeEach(() => { -/* selectSpy.and.callFake(() => { - return () => { - return () => hot('a', { - a: [] - } - ); - }; - });*/ + /* selectSpy.and.callFake(() => { + return () => { + return () => hot('a', { + a: [] + } + ); + }; + });*/ }); it('should return false', () => { diff --git a/src/app/shared/metadata-representation/metadata-representation-loader.component.spec.ts b/src/app/shared/metadata-representation/metadata-representation-loader.component.spec.ts index f137961ae0..bd5031ddc5 100644 --- a/src/app/shared/metadata-representation/metadata-representation-loader.component.spec.ts +++ b/src/app/shared/metadata-representation/metadata-representation-loader.component.spec.ts @@ -1,7 +1,10 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ChangeDetectionStrategy, ComponentFactoryResolver, NO_ERRORS_SCHEMA } from '@angular/core'; import { Context } from '../../core/shared/context.model'; -import { MetadataRepresentation, MetadataRepresentationType } from '../../core/shared/metadata-representation/metadata-representation.model'; +import { + MetadataRepresentation, + MetadataRepresentationType +} from '../../core/shared/metadata-representation/metadata-representation.model'; import { MetadataRepresentationLoaderComponent } from './metadata-representation-loader.component'; import { PlainTextMetadataListElementComponent } from '../object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component'; import { spyOnExported } from '../testing/utils.test'; @@ -25,11 +28,12 @@ class TestType implements MetadataRepresentation { return ''; } } + xdescribe('MetadataRepresentationLoaderComponent', () => { let comp: MetadataRepresentationLoaderComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [], declarations: [MetadataRepresentationLoaderComponent, PlainTextMetadataListElementComponent, MetadataRepresentationDirective], @@ -43,7 +47,7 @@ xdescribe('MetadataRepresentationLoaderComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(MetadataRepresentationLoaderComponent); comp = fixture.componentInstance; diff --git a/src/app/shared/metadata-representation/metadata-representation.decorator.spec.ts b/src/app/shared/metadata-representation/metadata-representation.decorator.spec.ts index 04432a8260..25c5be0129 100644 --- a/src/app/shared/metadata-representation/metadata-representation.decorator.spec.ts +++ b/src/app/shared/metadata-representation/metadata-representation.decorator.spec.ts @@ -1,4 +1,9 @@ -import { DEFAULT_ENTITY_TYPE, DEFAULT_REPRESENTATION_TYPE, getMetadataRepresentationComponent, metadataRepresentationComponent } from './metadata-representation.decorator'; +import { + DEFAULT_ENTITY_TYPE, + DEFAULT_REPRESENTATION_TYPE, + getMetadataRepresentationComponent, + metadataRepresentationComponent +} from './metadata-representation.decorator'; import { MetadataRepresentationType } from '../../core/shared/metadata-representation/metadata-representation.model'; import { Context } from '../../core/shared/context.model'; import * as uuidv4 from 'uuid/v4'; @@ -9,12 +14,23 @@ describe('MetadataRepresentation decorator function', () => { const type3 = 'TestType3'; const type4 = 'RandomType'; let prefix; + /* tslint:disable:max-classes-per-file */ - class Test1PlainText {} - class Test1Authority {} - class Test2Item {} - class Test2ItemSubmission {} - class Test3ItemSubmission {} + class Test1PlainText { + } + + class Test1Authority { + } + + class Test2Item { + } + + class Test2ItemSubmission { + } + + class Test3ItemSubmission { + } + /* tslint:enable:max-classes-per-file */ beforeEach(() => { diff --git a/src/app/shared/mocks/dspace-rest/endpoint-mocking-rest.service.spec.ts b/src/app/shared/mocks/dspace-rest/endpoint-mocking-rest.service.spec.ts index c35713669f..0b6b218164 100644 --- a/src/app/shared/mocks/dspace-rest/endpoint-mocking-rest.service.spec.ts +++ b/src/app/shared/mocks/dspace-rest/endpoint-mocking-rest.service.spec.ts @@ -19,7 +19,7 @@ describe('EndpointMockingRestService', () => { } as HttpResponse; mockResponseMap = new Map([ - [ '/foo', { bar: true } ] + ['/foo', { bar: true }] ]); const httpStub = jasmine.createSpyObj('http', { diff --git a/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.spec.ts b/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.spec.ts index 41e6d585e6..622c0bf18d 100644 --- a/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.spec.ts +++ b/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { of as observableOf } from 'rxjs'; @@ -19,7 +19,7 @@ describe('ClaimedTaskActionsApproveComponent', () => { submitTask: observableOf(new ProcessTaskResponse(true)) }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot({ diff --git a/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.spec.ts b/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.spec.ts index 0c80a175ad..8319a9a1db 100644 --- a/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.spec.ts +++ b/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { Router } from '@angular/router'; import { of as observableOf } from 'rxjs'; @@ -92,7 +92,7 @@ function init() { } describe('ClaimedTaskActionsComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ imports: [ @@ -139,7 +139,7 @@ describe('ClaimedTaskActionsComponent', () => { })); }); - it('should reload page on process completed', async(() => { + it('should reload page on process completed', waitForAsync(() => { spyOn(router, 'navigateByUrl'); router.url = 'test.url/test'; @@ -151,7 +151,7 @@ describe('ClaimedTaskActionsComponent', () => { }); })); - it('should display an error notification on process failure', async(() => { + it('should display an error notification on process failure', waitForAsync(() => { component.handleActionResponse(false); fixture.detectChanges(); diff --git a/src/app/shared/mydspace-actions/claimed-task/edit-metadata/claimed-task-actions-edit-metadata.component.spec.ts b/src/app/shared/mydspace-actions/claimed-task/edit-metadata/claimed-task-actions-edit-metadata.component.spec.ts index 705563941e..cdbb699ad0 100644 --- a/src/app/shared/mydspace-actions/claimed-task/edit-metadata/claimed-task-actions-edit-metadata.component.spec.ts +++ b/src/app/shared/mydspace-actions/claimed-task/edit-metadata/claimed-task-actions-edit-metadata.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; @@ -14,7 +14,7 @@ let fixture: ComponentFixture; describe('ClaimedTaskActionsEditMetadataComponent', () => { const object = Object.assign(new ClaimedTask(), { id: 'claimed-task-1' }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot({ diff --git a/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.spec.ts b/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.spec.ts index ab01776472..7f5dcc04d3 100644 --- a/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.spec.ts +++ b/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; @@ -24,7 +24,7 @@ describe('ClaimedTaskActionsRejectComponent', () => { submitTask: observableOf(new ProcessTaskResponse(true)) }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ NgbModule, diff --git a/src/app/shared/mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component.spec.ts b/src/app/shared/mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component.spec.ts index dc3f258017..76155e1903 100644 --- a/src/app/shared/mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component.spec.ts +++ b/src/app/shared/mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; @@ -19,7 +19,7 @@ describe('ClaimedTaskActionsReturnToPoolComponent', () => { returnToPoolTask: observableOf(new ProcessTaskResponse(true)) }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot({ diff --git a/src/app/shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-decorator.spec.ts b/src/app/shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-decorator.spec.ts index 07f3d0cd70..24b189deea 100644 --- a/src/app/shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-decorator.spec.ts +++ b/src/app/shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-decorator.spec.ts @@ -6,9 +6,15 @@ describe('ClaimedTaskActions decorator function', () => { const option3 = 'test_option_3'; /* tslint:disable:max-classes-per-file */ - class Test1Action {} - class Test2Action {} - class Test3Action {} + class Test1Action { + } + + class Test2Action { + } + + class Test3Action { + } + /* tslint:enable:max-classes-per-file */ beforeAll(() => { diff --git a/src/app/shared/mydspace-actions/item/item-actions.component.spec.ts b/src/app/shared/mydspace-actions/item/item-actions.component.spec.ts index 350883b240..e6abfa76a1 100644 --- a/src/app/shared/mydspace-actions/item/item-actions.component.spec.ts +++ b/src/app/shared/mydspace-actions/item/item-actions.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { Router } from '@angular/router'; import { of as observableOf } from 'rxjs'; @@ -59,7 +59,7 @@ const searchService = getMockSearchService(); const requestServce = getMockRequestService(); describe('ItemActionsComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot({ diff --git a/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.spec.ts b/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.spec.ts index 250a23183b..d3285dcb63 100644 --- a/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.spec.ts +++ b/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, TestBed, waitForAsync } from '@angular/core/testing'; import { Router } from '@angular/router'; import { By } from '@angular/platform-browser'; @@ -72,7 +72,7 @@ const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem); mockObject = Object.assign(new PoolTask(), { workflowitem: observableOf(rdWorkflowitem), id: '1234' }); describe('PoolTaskActionsComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot({ @@ -130,7 +130,7 @@ describe('PoolTaskActionsComponent', () => { it('should call claimTask method on claim', fakeAsync(() => { spyOn(component, 'reload'); - mockDataService.claimTask.and.returnValue(observableOf({hasSucceeded: true})); + mockDataService.claimTask.and.returnValue(observableOf({ hasSucceeded: true })); component.claim(); fixture.detectChanges(); @@ -141,9 +141,9 @@ describe('PoolTaskActionsComponent', () => { })); - it('should display a success notification on claim success', async(() => { + it('should display a success notification on claim success', waitForAsync(() => { spyOn(component, 'reload'); - mockDataService.claimTask.and.returnValue(observableOf({hasSucceeded: true})); + mockDataService.claimTask.and.returnValue(observableOf({ hasSucceeded: true })); component.claim(); fixture.detectChanges(); @@ -153,10 +153,10 @@ describe('PoolTaskActionsComponent', () => { }); })); - it('should reload page on claim success', async(() => { + it('should reload page on claim success', waitForAsync(() => { spyOn(router, 'navigateByUrl'); router.url = 'test.url/test'; - mockDataService.claimTask.and.returnValue(observableOf({hasSucceeded: true})); + mockDataService.claimTask.and.returnValue(observableOf({ hasSucceeded: true })); component.claim(); fixture.detectChanges(); @@ -166,8 +166,8 @@ describe('PoolTaskActionsComponent', () => { }); })); - it('should display an error notification on claim failure', async(() => { - mockDataService.claimTask.and.returnValue(observableOf({hasSucceeded: false})); + it('should display an error notification on claim failure', waitForAsync(() => { + mockDataService.claimTask.and.returnValue(observableOf({ hasSucceeded: false })); component.claim(); fixture.detectChanges(); @@ -177,7 +177,7 @@ describe('PoolTaskActionsComponent', () => { }); })); - it('should clear the object cache by href', async(() => { + it('should clear the object cache by href', waitForAsync(() => { component.reload(); fixture.detectChanges(); diff --git a/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.spec.ts b/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.spec.ts index af3a310d03..046eb2f018 100644 --- a/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.spec.ts +++ b/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { Router } from '@angular/router'; import { of as observableOf } from 'rxjs'; @@ -63,7 +63,7 @@ const rd = createSuccessfulRemoteDataObject(item); mockObject = Object.assign(new WorkflowItem(), { item: observableOf(rd), id: '1234', uuid: '1234' }); describe('WorkflowitemActionsComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot({ diff --git a/src/app/shared/mydspace-actions/workspaceitem/workspaceitem-actions.component.spec.ts b/src/app/shared/mydspace-actions/workspaceitem/workspaceitem-actions.component.spec.ts index 8400cc971d..8654740026 100644 --- a/src/app/shared/mydspace-actions/workspaceitem/workspaceitem-actions.component.spec.ts +++ b/src/app/shared/mydspace-actions/workspaceitem/workspaceitem-actions.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { Router } from '@angular/router'; import { By } from '@angular/platform-browser'; @@ -72,7 +72,7 @@ const rd = createSuccessfulRemoteDataObject(item); mockObject = Object.assign(new WorkspaceItem(), { item: observableOf(rd), id: '1234', uuid: '1234' }); describe('WorkspaceitemActionsComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ @@ -150,8 +150,8 @@ describe('WorkspaceitemActionsComponent', () => { }); - it('should display a success notification on delete success', async(() => { - spyOn((component as any).modalService, 'open').and.returnValue({result: Promise.resolve('ok')}); + it('should display a success notification on delete success', waitForAsync(() => { + spyOn((component as any).modalService, 'open').and.returnValue({ result: Promise.resolve('ok') }); mockDataService.delete.and.returnValue(createSuccessfulRemoteDataObject$({})); spyOn(component, 'reload'); @@ -163,8 +163,8 @@ describe('WorkspaceitemActionsComponent', () => { }); })); - it('should display an error notification on delete failure', async(() => { - spyOn((component as any).modalService, 'open').and.returnValue({result: Promise.resolve('ok')}); + it('should display an error notification on delete failure', waitForAsync(() => { + spyOn((component as any).modalService, 'open').and.returnValue({ result: Promise.resolve('ok') }); mockDataService.delete.and.returnValue(createFailedRemoteDataObject$('Error', 500)); spyOn(component, 'reload'); @@ -176,7 +176,7 @@ describe('WorkspaceitemActionsComponent', () => { }); })); - it('should clear the object cache by href', async(() => { + it('should clear the object cache by href', waitForAsync(() => { component.reload(); fixture.detectChanges(); diff --git a/src/app/shared/notifications/notification/notification.component.spec.ts b/src/app/shared/notifications/notification/notification.component.spec.ts index 3dd21fb2b1..7b7ee57d26 100644 --- a/src/app/shared/notifications/notification/notification.component.spec.ts +++ b/src/app/shared/notifications/notification/notification.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { BrowserModule, By } from '@angular/platform-browser'; import { ChangeDetectorRef, DebugElement } from '@angular/core'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; @@ -27,7 +27,7 @@ describe('NotificationComponent', () => { let elContent: HTMLElement; let elType: HTMLElement; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { const store: Store = jasmine.createSpyObj('store', { /* tslint:disable:no-empty */ notifications: [] @@ -40,14 +40,14 @@ describe('NotificationComponent', () => { timeOut: 5000, clickToClose: true, animate: 'scale' - }as INotificationBoardOptions, + } as INotificationBoardOptions, } as any; TestBed.configureTestingModule({ imports: [ BrowserModule, BrowserAnimationsModule, - StoreModule.forRoot({notificationsReducer}, storeModuleConfig), + StoreModule.forRoot({ notificationsReducer }, storeModuleConfig), TranslateModule.forRoot({ loader: { provide: TranslateLoader, @@ -60,12 +60,12 @@ describe('NotificationComponent', () => { ChangeDetectorRef, NotificationsService, TranslateService, - ] + ] }).compileComponents(); // compile template and css })); - beforeEach(() => { + beforeEach(() => { fixture = TestBed.createComponent(NotificationComponent); comp = fixture.componentInstance; comp.notification = { diff --git a/src/app/shared/notifications/notifications-board/notifications-board.component.spec.ts b/src/app/shared/notifications/notifications-board/notifications-board.component.spec.ts index 4d23aab31a..dad667cf3d 100644 --- a/src/app/shared/notifications/notifications-board/notifications-board.component.spec.ts +++ b/src/app/shared/notifications/notifications-board/notifications-board.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { BrowserModule } from '@angular/platform-browser'; import { ChangeDetectorRef } from '@angular/core'; @@ -7,7 +7,7 @@ import { notificationsReducer } from '../notifications.reducers'; import { Store, StoreModule } from '@ngrx/store'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { NotificationsBoardComponent } from './notifications-board.component'; -import { AppState, storeModuleConfig } from '../../../app.reducer'; +import { AppState } from '../../../app.reducer'; import { NotificationComponent } from '../notification/notification.component'; import { Notification } from '../models/notification.model'; import { NotificationType } from '../models/notification-type'; @@ -19,12 +19,12 @@ describe('NotificationsBoardComponent', () => { let comp: NotificationsBoardComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ BrowserModule, BrowserAnimationsModule, - StoreModule.forRoot({notificationsReducer}, { + StoreModule.forRoot({ notificationsReducer }, { runtimeChecks: { strictStateImmutability: false, strictActionImmutability: false diff --git a/src/app/shared/notifications/notifications.reducers.spec.ts b/src/app/shared/notifications/notifications.reducers.spec.ts index 6c9a77ec83..2b93e9bf94 100644 --- a/src/app/shared/notifications/notifications.reducers.spec.ts +++ b/src/app/shared/notifications/notifications.reducers.spec.ts @@ -28,7 +28,7 @@ describe('Notifications reducer', () => { providers: [NotificationsService], imports: [ ChangeDetectorRef, - StoreModule.forRoot({notificationsReducer}, storeModuleConfig), + StoreModule.forRoot({ notificationsReducer }, storeModuleConfig), ] }); diff --git a/src/app/shared/notifications/notifications.service.spec.ts b/src/app/shared/notifications/notifications.service.spec.ts index 282a2843d9..bb0f94eede 100644 --- a/src/app/shared/notifications/notifications.service.spec.ts +++ b/src/app/shared/notifications/notifications.service.spec.ts @@ -1,15 +1,11 @@ -import { TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { NotificationsService } from './notifications.service'; import { NotificationsBoardComponent } from './notifications-board/notifications-board.component'; import { NotificationComponent } from './notification/notification.component'; import { Store, StoreModule } from '@ngrx/store'; import { notificationsReducer } from './notifications.reducers'; import { of as observableOf } from 'rxjs'; -import { - NewNotificationAction, - RemoveAllNotificationsAction, - RemoveNotificationAction -} from './notifications.actions'; +import { NewNotificationAction, RemoveAllNotificationsAction, RemoveNotificationAction } from './notifications.actions'; import { Notification } from './models/notification.model'; import { NotificationType } from './models/notification-type'; import { GlobalConfig } from '../../../config/global-config.interface'; @@ -36,10 +32,10 @@ describe('NotificationsService test', () => { }, } as any; - beforeEach(async () => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ - StoreModule.forRoot({notificationsReducer}, storeModuleConfig), + StoreModule.forRoot({ notificationsReducer }, storeModuleConfig), TranslateModule.forRoot({ loader: { provide: TranslateLoader, @@ -56,7 +52,7 @@ describe('NotificationsService test', () => { }); service = TestBed.inject(NotificationsService); - }); + })); it('Success method should dispatch NewNotificationAction with proper parameter', () => { const notification = service.success('Title', observableOf('Content')); diff --git a/src/app/shared/number-picker/number-picker.component.spec.ts b/src/app/shared/number-picker/number-picker.component.spec.ts index 8cc287b0ff..de48df4e8e 100644 --- a/src/app/shared/number-picker/number-picker.component.spec.ts +++ b/src/app/shared/number-picker/number-picker.component.spec.ts @@ -1,6 +1,6 @@ // Load the implementations that should be tested import { ChangeDetectorRef, Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, inject, TestBed, } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync, } from '@angular/core/testing'; import { UploaderService } from '../uploader/uploader.service'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; @@ -17,8 +17,8 @@ describe('NumberPickerComponent test suite', () => { let numberPickerFixture: ComponentFixture; let html; - // async beforeEach - beforeEach(async(() => { + // waitForAsync beforeEach + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ diff --git a/src/app/shared/object-collection/object-collection.component.spec.ts b/src/app/shared/object-collection/object-collection.component.spec.ts index 2da0a852e9..703fb42554 100644 --- a/src/app/shared/object-collection/object-collection.component.spec.ts +++ b/src/app/shared/object-collection/object-collection.component.spec.ts @@ -1,6 +1,6 @@ import { ObjectCollectionComponent } from './object-collection.component'; import { By } from '@angular/platform-browser'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { of as observableOf } from 'rxjs'; @@ -19,18 +19,18 @@ describe('ObjectCollectionComponent', () => { scope: scopeParam }) }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ ObjectCollectionComponent ], + declarations: [ObjectCollectionComponent], providers: [ { provide: ActivatedRoute, useValue: activatedRouteStub }, { provide: Router, useClass: RouterStub } ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).compileComponents(); // compile template and css })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ObjectCollectionComponent); objectCollectionComponent = fixture.componentInstance; })); diff --git a/src/app/shared/object-collection/shared/listable-object/listable-object.decorator.spec.ts b/src/app/shared/object-collection/shared/listable-object/listable-object.decorator.spec.ts index 4bd8cc3967..19765f86b0 100644 --- a/src/app/shared/object-collection/shared/listable-object/listable-object.decorator.spec.ts +++ b/src/app/shared/object-collection/shared/listable-object/listable-object.decorator.spec.ts @@ -9,12 +9,24 @@ describe('ListableObject decorator function', () => { const type3 = 'TestType3'; /* tslint:disable:max-classes-per-file */ - class Test1List {} - class Test1Grid {} - class Test2List {} - class Test2ListSubmission {} - class Test3List {} - class Test3DetailedSubmission {} + class Test1List { + } + + class Test1Grid { + } + + class Test2List { + } + + class Test2ListSubmission { + } + + class Test3List { + } + + class Test3DetailedSubmission { + } + /* tslint:enable:max-classes-per-file */ beforeEach(() => { diff --git a/src/app/shared/object-collection/shared/mydspace-item-status/my-dspace-item-status.component.spec.ts b/src/app/shared/object-collection/shared/mydspace-item-status/my-dspace-item-status.component.spec.ts index 1d71de3af6..44e6a44b70 100644 --- a/src/app/shared/object-collection/shared/mydspace-item-status/my-dspace-item-status.component.spec.ts +++ b/src/app/shared/object-collection/shared/mydspace-item-status/my-dspace-item-status.component.spec.ts @@ -1,11 +1,9 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { of as observableOf } from 'rxjs'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; -import { RemoteData } from '../../../../core/data/remote-data'; - import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model'; import { PoolTask } from '../../../../core/tasks/models/pool-task-object.model'; import { EPersonMock } from '../../../testing/eperson.mock'; @@ -26,7 +24,7 @@ const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem); mockResultObject = Object.assign(new PoolTask(), { workflowitem: observableOf(rdWorkflowitem) }); describe('MyDSpaceItemStatusComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot({ diff --git a/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.spec.ts b/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.spec.ts index 8af8893904..261759dfe6 100644 --- a/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.spec.ts +++ b/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.spec.ts @@ -1,11 +1,9 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { of as observableOf } from 'rxjs'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { cold } from 'jasmine-marbles'; - -import { RemoteData } from '../../../../core/data/remote-data'; import { ItemSubmitterComponent } from './item-submitter.component'; import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model'; import { PoolTask } from '../../../../core/tasks/models/pool-task-object.model'; @@ -27,7 +25,7 @@ const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem); mockResultObject = Object.assign(new PoolTask(), { workflowitem: observableOf(rdWorkflowitem) }); describe('ItemSubmitterComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot({ @@ -44,7 +42,7 @@ describe('ItemSubmitterComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ItemSubmitterComponent); component = fixture.componentInstance; })); diff --git a/src/app/shared/object-collection/shared/selectable-list-item-control/selectable-list-item-control.component.spec.ts b/src/app/shared/object-collection/shared/selectable-list-item-control/selectable-list-item-control.component.spec.ts index 25cf6b15f0..c8756567b8 100644 --- a/src/app/shared/object-collection/shared/selectable-list-item-control/selectable-list-item-control.component.spec.ts +++ b/src/app/shared/object-collection/shared/selectable-list-item-control/selectable-list-item-control.component.spec.ts @@ -1,4 +1,4 @@ -import { ComponentFixture, TestBed, async, tick, fakeAsync } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; import { SelectableListService } from '../../../object-list/selectable-list/selectable-list.service'; import { SelectableListItemControlComponent } from './selectable-list-item-control.component'; @@ -27,9 +27,9 @@ describe('SelectableListItemControlComponent', () => { uuid1 = '0beb44f8-d2ed-459a-a1e7-ffbe059089a9'; uuid2 = 'e1dc80aa-c269-4aa5-b6bd-008d98056247'; listId = 'Test List ID'; - object = Object.assign(new Item(), {uuid: uuid1}); - otherObject = Object.assign(new Item(), {uuid: uuid2}); - selectionConfig = {repeatable: false, listId}; + object = Object.assign(new Item(), { uuid: uuid1 }); + otherObject = Object.assign(new Item(), { uuid: uuid2 }); + selectionConfig = { repeatable: false, listId }; index = 0; selection = [otherObject]; selectionService = jasmine.createSpyObj('selectionService', { @@ -41,7 +41,7 @@ describe('SelectableListItemControlComponent', () => { ); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ declarations: [SelectableListItemControlComponent, VarDirective], @@ -78,13 +78,13 @@ describe('SelectableListItemControlComponent', () => { }); it('should call selectSingle on the service when the object when selectRadio is called with value true and deselect all others in the selection', () => { - comp.selectRadio(true ); + comp.selectRadio(true); expect(selectionService.deselectSingle).toHaveBeenCalledWith(listId, selection[0]); expect(selectionService.selectSingle).toHaveBeenCalledWith(listId, object); }); it('should not call selectSingle on the service when the object when selectRadio is called with value false and not deselect all others in the selection', () => { - comp.selectRadio(false ); + comp.selectRadio(false); expect(selectionService.deselectSingle).not.toHaveBeenCalledWith(listId, selection[0]); expect(selectionService.selectSingle).not.toHaveBeenCalledWith(listId, object); }); diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-task-search-result/claimed-task-search-result-detail-element.component.spec.ts b/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-task-search-result/claimed-task-search-result-detail-element.component.spec.ts index a2010691b6..f88a46204f 100644 --- a/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-task-search-result/claimed-task-search-result-detail-element.component.spec.ts +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-task-search-result/claimed-task-search-result-detail-element.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { of as observableOf } from 'rxjs'; @@ -59,7 +59,7 @@ mockResultObject.indexableObject = Object.assign(new ClaimedTask(), { workflowit const linkService = getMockLinkService(); describe('ClaimedTaskSearchResultDetailElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [ClaimedTaskSearchResultDetailElementComponent, VarDirective], @@ -72,7 +72,7 @@ describe('ClaimedTaskSearchResultDetailElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ClaimedTaskSearchResultDetailElementComponent); component = fixture.componentInstance; })); diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component.spec.ts b/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component.spec.ts index e4fda08960..56a0df1faa 100644 --- a/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component.spec.ts +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; @@ -45,7 +45,7 @@ const mockItemWithAuthorAndDate: Item = Object.assign(new Item(), { }); describe('ItemDetailPreviewFieldComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ NoopAnimationsModule, @@ -68,7 +68,7 @@ describe('ItemDetailPreviewFieldComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ItemDetailPreviewFieldComponent); component = fixture.componentInstance; diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview.component.spec.ts b/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview.component.spec.ts index 11ea00352d..2b38b58598 100644 --- a/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview.component.spec.ts +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview.component.spec.ts @@ -1,6 +1,6 @@ import { HttpClient } from '@angular/common/http'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { Store } from '@ngrx/store'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; @@ -82,7 +82,7 @@ describe('ItemDetailPreviewComponent', () => { return createSuccessfulRemoteDataObject$(createPaginatedList([])); }, }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ NoopAnimationsModule, @@ -115,7 +115,7 @@ describe('ItemDetailPreviewComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ItemDetailPreviewComponent); component = fixture.componentInstance; component.object = { hitHighlights: {} } as any; diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/item-search-result/item-search-result-detail-element.component.spec.ts b/src/app/shared/object-detail/my-dspace-result-detail-element/item-search-result/item-search-result-detail-element.component.spec.ts index b0db04f1da..8d602d5eb2 100644 --- a/src/app/shared/object-detail/my-dspace-result-detail-element/item-search-result/item-search-result-detail-element.component.spec.ts +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/item-search-result/item-search-result-detail-element.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { of as observableOf } from 'rxjs'; @@ -48,7 +48,7 @@ mockResultObject.indexableObject = Object.assign(new Item(), { }); describe('ItemSearchResultDetailElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [ItemSearchResultDetailElementComponent], @@ -58,7 +58,7 @@ describe('ItemSearchResultDetailElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ItemSearchResultDetailElementComponent); component = fixture.componentInstance; })); diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/pool-search-result/pool-search-result-detail-element.component.spec.ts b/src/app/shared/object-detail/my-dspace-result-detail-element/pool-search-result/pool-search-result-detail-element.component.spec.ts index 0c2b3a0a70..68eb398f13 100644 --- a/src/app/shared/object-detail/my-dspace-result-detail-element/pool-search-result/pool-search-result-detail-element.component.spec.ts +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/pool-search-result/pool-search-result-detail-element.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { of as observableOf } from 'rxjs'; @@ -59,7 +59,7 @@ mockResultObject.indexableObject = Object.assign(new PoolTask(), { workflowitem: const linkService = getMockLinkService(); describe('PoolSearchResultDetailElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [PoolSearchResultDetailElementComponent, VarDirective], @@ -74,7 +74,7 @@ describe('PoolSearchResultDetailElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(PoolSearchResultDetailElementComponent); component = fixture.componentInstance; })); diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/workflow-item-search-result/workflow-item-search-result-detail-element.component.spec.ts b/src/app/shared/object-detail/my-dspace-result-detail-element/workflow-item-search-result/workflow-item-search-result-detail-element.component.spec.ts index e88b0a1d16..3612a8e7da 100644 --- a/src/app/shared/object-detail/my-dspace-result-detail-element/workflow-item-search-result/workflow-item-search-result-detail-element.component.spec.ts +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/workflow-item-search-result/workflow-item-search-result-detail-element.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { of as observableOf } from 'rxjs'; @@ -52,7 +52,7 @@ const rd = createSuccessfulRemoteDataObject(item); mockResultObject.indexableObject = Object.assign(new WorkflowItem(), { item: observableOf(rd) }); describe('WorkflowItemSearchResultDetailElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [WorkflowItemSearchResultDetailElementComponent], @@ -66,7 +66,7 @@ describe('WorkflowItemSearchResultDetailElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(WorkflowItemSearchResultDetailElementComponent); component = fixture.componentInstance; })); diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/workspace-item-search-result/workspace-item-search-result-detail-element.component.spec.ts b/src/app/shared/object-detail/my-dspace-result-detail-element/workspace-item-search-result/workspace-item-search-result-detail-element.component.spec.ts index d28158d70a..0e79939e36 100644 --- a/src/app/shared/object-detail/my-dspace-result-detail-element/workspace-item-search-result/workspace-item-search-result-detail-element.component.spec.ts +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/workspace-item-search-result/workspace-item-search-result-detail-element.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { of as observableOf } from 'rxjs'; @@ -52,7 +52,7 @@ const rd = createSuccessfulRemoteDataObject(item); mockResultObject.indexableObject = Object.assign(new WorkspaceItem(), { item: observableOf(rd) }); describe('WorkspaceItemSearchResultDetailElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [WorkspaceItemSearchResultDetailElementComponent], @@ -66,7 +66,7 @@ describe('WorkspaceItemSearchResultDetailElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(WorkspaceItemSearchResultDetailElementComponent); component = fixture.componentInstance; })); diff --git a/src/app/shared/object-detail/object-detail.component.spec.ts b/src/app/shared/object-detail/object-detail.component.spec.ts index 4c39990c0d..d0fcbed4eb 100644 --- a/src/app/shared/object-detail/object-detail.component.spec.ts +++ b/src/app/shared/object-detail/object-detail.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { ObjectDetailComponent } from './object-detail.component'; @@ -13,24 +13,29 @@ import { DSpaceObject } from '../../core/shared/dspace-object.model'; describe('ObjectDetailComponent', () => { let comp: ObjectDetailComponent; let fixture: ComponentFixture; - const testEvent: any = {test: 'test'}; + const testEvent: any = { test: 'test' }; const testObjects = [ - Object.assign (new DSpaceObject(), { one: 1 }), - Object.assign (new DSpaceObject(), { two: 2 }), - Object.assign (new DSpaceObject(), { three: 3 }), - Object.assign (new DSpaceObject(), { four: 4 }), - Object.assign (new DSpaceObject(), { five: 5 }), - Object.assign (new DSpaceObject(), { six: 6 }), - Object.assign (new DSpaceObject(), { seven: 7 }), - Object.assign (new DSpaceObject(), { eight: 8 }), - Object.assign (new DSpaceObject(), { nine: 9 }), - Object.assign (new DSpaceObject(), { ten: 10 }), + Object.assign(new DSpaceObject(), { one: 1 }), + Object.assign(new DSpaceObject(), { two: 2 }), + Object.assign(new DSpaceObject(), { three: 3 }), + Object.assign(new DSpaceObject(), { four: 4 }), + Object.assign(new DSpaceObject(), { five: 5 }), + Object.assign(new DSpaceObject(), { six: 6 }), + Object.assign(new DSpaceObject(), { seven: 7 }), + Object.assign(new DSpaceObject(), { eight: 8 }), + Object.assign(new DSpaceObject(), { nine: 9 }), + Object.assign(new DSpaceObject(), { ten: 10 }), ]; - const pageInfo = Object.assign(new PageInfo(), {elementsPerPage: 1, totalElements: 10, totalPages: 10, currentPage: 1}); + const pageInfo = Object.assign(new PageInfo(), { + elementsPerPage: 1, + totalElements: 10, + totalPages: 10, + currentPage: 1 + }); const mockRD = createSuccessfulRemoteDataObject(buildPaginatedList(pageInfo, testObjects)); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ NoopAnimationsModule, diff --git a/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.spec.ts b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.spec.ts index efd4d0645c..8f80cea1d3 100644 --- a/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.spec.ts @@ -1,5 +1,5 @@ import { CollectionGridElementComponent } from './collection-grid-element.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { Collection } from '../../../core/shared/collection.model'; @@ -35,21 +35,21 @@ const linkService = jasmine.createSpyObj('linkService', { }); describe('CollectionGridElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ CollectionGridElementComponent ], + declarations: [CollectionGridElementComponent], providers: [ - { provide: 'objectElementProvider', useValue: (mockCollectionWithAbstract)}, - { provide: LinkService, useValue: linkService} + { provide: 'objectElementProvider', useValue: (mockCollectionWithAbstract) }, + { provide: LinkService, useValue: linkService } ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(CollectionGridElementComponent, { set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(CollectionGridElementComponent); collectionGridElementComponent = fixture.componentInstance; })); diff --git a/src/app/shared/object-grid/community-grid-element/community-grid-element.component.spec.ts b/src/app/shared/object-grid/community-grid-element/community-grid-element.component.spec.ts index dfcac7dc1f..c678dadd5c 100644 --- a/src/app/shared/object-grid/community-grid-element/community-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/community-grid-element/community-grid-element.component.spec.ts @@ -1,5 +1,5 @@ import { CommunityGridElementComponent } from './community-grid-element.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { Community } from '../../../core/shared/community.model'; @@ -35,21 +35,21 @@ const linkService = jasmine.createSpyObj('linkService', { }); describe('CommunityGridElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ CommunityGridElementComponent ], + declarations: [CommunityGridElementComponent], providers: [ - { provide: 'objectElementProvider', useValue: (mockCommunityWithAbstract)}, - { provide: LinkService, useValue: linkService} + { provide: 'objectElementProvider', useValue: (mockCommunityWithAbstract) }, + { provide: LinkService, useValue: linkService } ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(CommunityGridElementComponent, { set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(CommunityGridElementComponent); communityGridElementComponent = fixture.componentInstance; })); diff --git a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.spec.ts b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.spec.ts index 719341a286..825a4d5c60 100644 --- a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.spec.ts +++ b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.spec.ts @@ -1,5 +1,5 @@ import { DebugElement } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { Bitstream } from '../../../core/shared/bitstream.model'; import { SafeUrlPipe } from '../../utils/safe-url-pipe'; @@ -12,7 +12,7 @@ describe('GridThumbnailComponent', () => { let de: DebugElement; let el: HTMLElement; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [GridThumbnailComponent, SafeUrlPipe] }).compileComponents(); diff --git a/src/app/shared/object-grid/item-grid-element/item-types/item/item-grid-element.component.spec.ts b/src/app/shared/object-grid/item-grid-element/item-types/item/item-grid-element.component.spec.ts index e84bf94117..645897ebbf 100644 --- a/src/app/shared/object-grid/item-grid-element/item-types/item/item-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/item-grid-element/item-types/item/item-grid-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TruncatePipe } from '../../../../utils/truncate.pipe'; import { TruncatableService } from '../../../../truncatable/truncatable.service'; @@ -49,7 +49,7 @@ describe('ItemGridElementComponent', () => { isCollapsed: (id: number) => observableOf(true), }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [ItemGridElementComponent, TruncatePipe], @@ -62,7 +62,7 @@ describe('ItemGridElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ItemGridElementComponent); comp = fixture.componentInstance; })); diff --git a/src/app/shared/object-grid/object-grid.component.spec.ts b/src/app/shared/object-grid/object-grid.component.spec.ts index 2ced28718a..61571f334d 100644 --- a/src/app/shared/object-grid/object-grid.component.spec.ts +++ b/src/app/shared/object-grid/object-grid.component.spec.ts @@ -132,11 +132,13 @@ describe('ObjectGridComponent', () => { comp.ngOnInit(); - const expected = cold('c', { c: [ + const expected = cold('c', { + c: [ [testObjects[0], testObjects[3], testObjects[6], testObjects[9]], [testObjects[1], testObjects[4], testObjects[7]], [testObjects[2], testObjects[5], testObjects[8]] - ] }); + ] + }); const result = comp.columns$; @@ -153,11 +155,13 @@ describe('ObjectGridComponent', () => { comp.ngOnInit(); - const expected = cold('c', { c: [ + const expected = cold('c', { + c: [ [testObjects[0], testObjects[3], testObjects[6], testObjects[9]], [testObjects[1], testObjects[4], testObjects[7]], [testObjects[2], testObjects[5], testObjects[8]] - ] }); + ] + }); const result = comp.columns$; @@ -174,10 +178,12 @@ describe('ObjectGridComponent', () => { comp.ngOnInit(); - const expected = cold('c', { c: [ + const expected = cold('c', { + c: [ [testObjects[0], testObjects[2], testObjects[4], testObjects[6], testObjects[8]], [testObjects[1], testObjects[3], testObjects[5], testObjects[7], testObjects[9]], - ] }); + ] + }); const result = comp.columns$; @@ -194,10 +200,12 @@ describe('ObjectGridComponent', () => { comp.ngOnInit(); - const expected = cold('c', { c: [ + const expected = cold('c', { + c: [ [testObjects[0], testObjects[2], testObjects[4], testObjects[6], testObjects[8]], [testObjects[1], testObjects[3], testObjects[5], testObjects[7], testObjects[9]], - ] }); + ] + }); const result = comp.columns$; @@ -214,7 +222,7 @@ describe('ObjectGridComponent', () => { comp.ngOnInit(); - const expected = cold('c', { c: [ testObjects ] }); + const expected = cold('c', { c: [testObjects] }); const result = comp.columns$; diff --git a/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.spec.ts b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.spec.ts index d40b99316a..065efbf379 100644 --- a/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.spec.ts @@ -1,6 +1,6 @@ import { HttpClient } from '@angular/common/http'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { Store } from '@ngrx/store'; import { of as observableOf } from 'rxjs'; @@ -58,9 +58,9 @@ const linkService = jasmine.createSpyObj('linkService', { }); describe('CollectionSearchResultGridElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ CollectionSearchResultGridElementComponent, TruncatePipe ], + declarations: [CollectionSearchResultGridElementComponent, TruncatePipe], providers: [ { provide: TruncatableService, useValue: truncatableServiceStub }, { provide: 'objectElementProvider', useValue: (mockCollectionWithAbstract) }, @@ -76,16 +76,16 @@ describe('CollectionSearchResultGridElementComponent', () => { { provide: DSOChangeAnalyzer, useValue: {} }, { provide: DefaultChangeAnalyzer, useValue: {} }, { provide: BitstreamFormatDataService, useValue: {} }, - { provide: LinkService, useValue: linkService} + { provide: LinkService, useValue: linkService } ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(CollectionSearchResultGridElementComponent, { set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(CollectionSearchResultGridElementComponent); collectionSearchResultGridElementComponent = fixture.componentInstance; })); diff --git a/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.spec.ts b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.spec.ts index 7b3fe0a7dc..42005d745e 100644 --- a/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.spec.ts @@ -1,6 +1,6 @@ import { HttpClient } from '@angular/common/http'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { Store } from '@ngrx/store'; import { of as observableOf } from 'rxjs'; @@ -58,9 +58,9 @@ const linkService = jasmine.createSpyObj('linkService', { }); describe('CommunitySearchResultGridElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ CommunitySearchResultGridElementComponent, TruncatePipe ], + declarations: [CommunitySearchResultGridElementComponent, TruncatePipe], providers: [ { provide: TruncatableService, useValue: truncatableServiceStub }, { provide: 'objectElementProvider', useValue: (mockCommunityWithAbstract) }, @@ -76,16 +76,16 @@ describe('CommunitySearchResultGridElementComponent', () => { { provide: DSOChangeAnalyzer, useValue: {} }, { provide: DefaultChangeAnalyzer, useValue: {} }, { provide: BitstreamFormatDataService, useValue: {} }, - { provide: LinkService, useValue: linkService} + { provide: LinkService, useValue: linkService } ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(CommunitySearchResultGridElementComponent, { set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(CommunitySearchResultGridElementComponent); communitySearchResultGridElementComponent = fixture.componentInstance; })); diff --git a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item/item-search-result-grid-element.component.spec.ts b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item/item-search-result-grid-element.component.spec.ts index 70a570d745..ca6614efbc 100644 --- a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item/item-search-result-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item/item-search-result-grid-element.component.spec.ts @@ -1,6 +1,6 @@ import { HttpClient } from '@angular/common/http'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { Store } from '@ngrx/store'; @@ -97,7 +97,7 @@ export function getEntityGridElementTestComponent(component, searchResultWithMet } }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [component, TruncatePipe], @@ -121,7 +121,7 @@ export function getEntityGridElementTestComponent(component, searchResultWithMet }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(component); comp = fixture.componentInstance; })); diff --git a/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.spec.ts b/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.spec.ts index 54b58e131a..d37f82234d 100644 --- a/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.spec.ts +++ b/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { TruncatePipe } from '../../utils/truncate.pipe'; @@ -14,20 +14,20 @@ const mockValue: BrowseEntry = Object.assign(new BrowseEntry(), { }); describe('MetadataListElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ BrowseEntryListElementComponent , TruncatePipe], + declarations: [BrowseEntryListElementComponent, TruncatePipe], providers: [ - { provide: 'objectElementProvider', useValue: {mockValue}} + { provide: 'objectElementProvider', useValue: { mockValue } } ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(BrowseEntryListElementComponent, { set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(BrowseEntryListElementComponent); browseEntryListElementComponent = fixture.componentInstance; })); diff --git a/src/app/shared/object-list/collection-list-element/collection-list-element.component.spec.ts b/src/app/shared/object-list/collection-list-element/collection-list-element.component.spec.ts index bde6b4b97a..c41d5a7314 100644 --- a/src/app/shared/object-list/collection-list-element/collection-list-element.component.spec.ts +++ b/src/app/shared/object-list/collection-list-element/collection-list-element.component.spec.ts @@ -1,5 +1,5 @@ import { CollectionListElementComponent } from './collection-list-element.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { Collection } from '../../../core/shared/collection.model'; @@ -30,20 +30,20 @@ const mockCollectionWithoutAbstract: Collection = Object.assign(new Collection() }); describe('CollectionListElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ CollectionListElementComponent ], + declarations: [CollectionListElementComponent], providers: [ - { provide: 'objectElementProvider', useValue: (mockCollectionWithAbstract)} + { provide: 'objectElementProvider', useValue: (mockCollectionWithAbstract) } ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(CollectionListElementComponent, { set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(CollectionListElementComponent); collectionListElementComponent = fixture.componentInstance; })); diff --git a/src/app/shared/object-list/community-list-element/community-list-element.component.spec.ts b/src/app/shared/object-list/community-list-element/community-list-element.component.spec.ts index 46ba27eb00..cd212e0399 100644 --- a/src/app/shared/object-list/community-list-element/community-list-element.component.spec.ts +++ b/src/app/shared/object-list/community-list-element/community-list-element.component.spec.ts @@ -1,5 +1,5 @@ import { CommunityListElementComponent } from './community-list-element.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { Community } from '../../../core/shared/community.model'; @@ -30,20 +30,20 @@ const mockCommunityWithoutAbstract: Community = Object.assign(new Community(), { }); describe('CommunityListElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ CommunityListElementComponent ], + declarations: [CommunityListElementComponent], providers: [ - { provide: 'objectElementProvider', useValue: (mockCommunityWithAbstract)} + { provide: 'objectElementProvider', useValue: (mockCommunityWithAbstract) } ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(CommunityListElementComponent, { set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(CommunityListElementComponent); communityListElementComponent = fixture.componentInstance; })); diff --git a/src/app/shared/object-list/item-list-element/item-types/item/item-list-element.component.spec.ts b/src/app/shared/object-list/item-list-element/item-types/item/item-list-element.component.spec.ts index 6897b81f0a..de30c23216 100644 --- a/src/app/shared/object-list/item-list-element/item-types/item/item-list-element.component.spec.ts +++ b/src/app/shared/object-list/item-list-element/item-types/item/item-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { ItemListElementComponent } from './item-list-element.component'; @@ -51,7 +51,7 @@ describe('ItemListElementComponent', () => { isCollapsed: (id: number) => observableOf(true), }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ItemListElementComponent, TruncatePipe], providers: [ @@ -63,7 +63,7 @@ describe('ItemListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ItemListElementComponent); comp = fixture.componentInstance; })); diff --git a/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.spec.ts b/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.spec.ts index c195268456..6e48ba3a6f 100644 --- a/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.spec.ts +++ b/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { ItemMetadataListElementComponent } from './item-metadata-list-element.component'; import { By } from '@angular/platform-browser'; @@ -10,17 +10,17 @@ describe('ItemMetadataListElementComponent', () => { let comp: ItemMetadataListElementComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [], declarations: [ItemMetadataListElementComponent], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(ItemMetadataListElementComponent, { - set: {changeDetection: ChangeDetectionStrategy.Default} + set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ItemMetadataListElementComponent); comp = fixture.componentInstance; comp.metadataRepresentation = mockItemMetadataRepresentation; diff --git a/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.spec.ts b/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.spec.ts index 9a409aa147..af09d3c204 100644 --- a/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.spec.ts +++ b/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { PlainTextMetadataListElementComponent } from './plain-text-metadata-list-element.component'; import { MetadatumRepresentation } from '../../../../core/shared/metadata-representation/metadatum/metadatum-representation.model'; @@ -12,17 +12,17 @@ describe('PlainTextMetadataListElementComponent', () => { let comp: PlainTextMetadataListElementComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [], declarations: [PlainTextMetadataListElementComponent], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(PlainTextMetadataListElementComponent, { - set: {changeDetection: ChangeDetectionStrategy.Default} + set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(PlainTextMetadataListElementComponent); comp = fixture.componentInstance; comp.metadataRepresentation = mockMetadataRepresentation; diff --git a/src/app/shared/object-list/my-dspace-result-list-element/claimed-search-result/claimed-search-result-list-element.component.spec.ts b/src/app/shared/object-list/my-dspace-result-list-element/claimed-search-result/claimed-search-result-list-element.component.spec.ts index f06f3eac81..151d205273 100644 --- a/src/app/shared/object-list/my-dspace-result-list-element/claimed-search-result/claimed-search-result-list-element.component.spec.ts +++ b/src/app/shared/object-list/my-dspace-result-list-element/claimed-search-result/claimed-search-result-list-element.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { of as observableOf } from 'rxjs'; @@ -60,7 +60,7 @@ mockResultObject.indexableObject = Object.assign(new ClaimedTask(), { workflowit const linkService = getMockLinkService(); describe('ClaimedSearchResultListElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [ClaimedSearchResultListElementComponent, VarDirective], @@ -74,7 +74,7 @@ describe('ClaimedSearchResultListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ClaimedSearchResultListElementComponent); component = fixture.componentInstance; })); diff --git a/src/app/shared/object-list/my-dspace-result-list-element/item-search-result/item-search-result-list-element-submission.component.spec.ts b/src/app/shared/object-list/my-dspace-result-list-element/item-search-result/item-search-result-list-element-submission.component.spec.ts index 45af23320f..07174ac74f 100644 --- a/src/app/shared/object-list/my-dspace-result-list-element/item-search-result/item-search-result-list-element-submission.component.spec.ts +++ b/src/app/shared/object-list/my-dspace-result-list-element/item-search-result/item-search-result-list-element-submission.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { of as observableOf } from 'rxjs'; @@ -49,7 +49,7 @@ mockResultObject.indexableObject = Object.assign(new Item(), { }); describe('ItemMyDSpaceResultListElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [ItemSearchResultListElementSubmissionComponent], @@ -62,7 +62,7 @@ describe('ItemMyDSpaceResultListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ItemSearchResultListElementSubmissionComponent); component = fixture.componentInstance; })); diff --git a/src/app/shared/object-list/my-dspace-result-list-element/pool-search-result/pool-search-result-list-element.component.spec.ts b/src/app/shared/object-list/my-dspace-result-list-element/pool-search-result/pool-search-result-list-element.component.spec.ts index fbeb63c667..74c64ca254 100644 --- a/src/app/shared/object-list/my-dspace-result-list-element/pool-search-result/pool-search-result-list-element.component.spec.ts +++ b/src/app/shared/object-list/my-dspace-result-list-element/pool-search-result/pool-search-result-list-element.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { of as observableOf } from 'rxjs'; @@ -60,7 +60,7 @@ mockResultObject.indexableObject = Object.assign(new PoolTask(), { workflowitem: const linkService = getMockLinkService(); describe('PoolSearchResultListElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [PoolSearchResultListElementComponent, VarDirective], @@ -74,7 +74,7 @@ describe('PoolSearchResultListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(PoolSearchResultListElementComponent); component = fixture.componentInstance; })); diff --git a/src/app/shared/object-list/my-dspace-result-list-element/workflow-item-search-result/workflow-item-search-result-list-element.component.spec.ts b/src/app/shared/object-list/my-dspace-result-list-element/workflow-item-search-result/workflow-item-search-result-list-element.component.spec.ts index e33d48686c..1ee6eaeaf4 100644 --- a/src/app/shared/object-list/my-dspace-result-list-element/workflow-item-search-result/workflow-item-search-result-list-element.component.spec.ts +++ b/src/app/shared/object-list/my-dspace-result-list-element/workflow-item-search-result/workflow-item-search-result-list-element.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { of as observableOf } from 'rxjs'; @@ -59,7 +59,7 @@ mockResultObject.indexableObject = Object.assign(new WorkflowItem(), { item: obs let linkService; describe('WorkflowItemSearchResultListElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { linkService = getMockLinkService(); TestBed.configureTestingModule({ imports: [NoopAnimationsModule], @@ -75,7 +75,7 @@ describe('WorkflowItemSearchResultListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(WorkflowItemSearchResultListElementComponent); component = fixture.componentInstance; })); diff --git a/src/app/shared/object-list/my-dspace-result-list-element/workspace-item-search-result/workspace-item-search-result-list-element.component.spec.ts b/src/app/shared/object-list/my-dspace-result-list-element/workspace-item-search-result/workspace-item-search-result-list-element.component.spec.ts index 69f5906d73..4307cfd163 100644 --- a/src/app/shared/object-list/my-dspace-result-list-element/workspace-item-search-result/workspace-item-search-result-list-element.component.spec.ts +++ b/src/app/shared/object-list/my-dspace-result-list-element/workspace-item-search-result/workspace-item-search-result-list-element.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { of as observableOf } from 'rxjs'; @@ -58,7 +58,7 @@ mockResultObject.indexableObject = Object.assign(new WorkspaceItem(), { item: ob let linkService; describe('WorkspaceItemSearchResultListElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { linkService = getMockLinkService(); TestBed.configureTestingModule({ imports: [NoopAnimationsModule], @@ -74,7 +74,7 @@ describe('WorkspaceItemSearchResultListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(WorkspaceItemSearchResultListElementComponent); component = fixture.componentInstance; })); diff --git a/src/app/shared/object-list/object-list.component.spec.ts b/src/app/shared/object-list/object-list.component.spec.ts index 4ed3519b03..ef04582695 100644 --- a/src/app/shared/object-list/object-list.component.spec.ts +++ b/src/app/shared/object-list/object-list.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { ObjectListComponent } from './object-list.component'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; @@ -9,7 +9,7 @@ describe('ObjectListComponent', () => { let fixture: ComponentFixture; const testEvent: any = { test: 'test' }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [], declarations: [ObjectListComponent], diff --git a/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.spec.ts b/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.spec.ts index 9de1e085b5..d50fdccb80 100644 --- a/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.spec.ts +++ b/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.spec.ts @@ -1,5 +1,5 @@ import { CollectionSearchResultListElementComponent } from './collection-search-result-list-element.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { of as observableOf } from 'rxjs'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; @@ -42,19 +42,19 @@ mockCollectionWithoutAbstract.indexableObject = Object.assign(new Collection(), }); describe('CollectionSearchResultListElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ CollectionSearchResultListElementComponent, TruncatePipe ], + declarations: [CollectionSearchResultListElementComponent, TruncatePipe], providers: [ { provide: TruncatableService, useValue: truncatableServiceStub }, ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(CollectionSearchResultListElementComponent, { set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(CollectionSearchResultListElementComponent); collectionSearchResultListElementComponent = fixture.componentInstance; collectionSearchResultListElementComponent.object = mockCollectionWithAbstract; diff --git a/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.spec.ts b/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.spec.ts index 2bf61c2ab9..c5588f5371 100644 --- a/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.spec.ts +++ b/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.spec.ts @@ -1,5 +1,5 @@ import { CommunitySearchResultListElementComponent } from './community-search-result-list-element.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { of as observableOf } from 'rxjs'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; @@ -42,20 +42,20 @@ mockCommunityWithoutAbstract.indexableObject = Object.assign(new Community(), { }); describe('CommunitySearchResultListElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ CommunitySearchResultListElementComponent, TruncatePipe ], + declarations: [CommunitySearchResultListElementComponent, TruncatePipe], providers: [ { provide: TruncatableService, useValue: truncatableServiceStub }, ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(CommunitySearchResultListElementComponent, { set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(CommunitySearchResultListElementComponent); communitySearchResultListElementComponent = fixture.componentInstance; communitySearchResultListElementComponent.object = mockCommunityWithAbstract; diff --git a/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component.spec.ts b/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component.spec.ts index d76bf96ff5..f8a8be415d 100644 --- a/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component.spec.ts +++ b/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { of as observableOf } from 'rxjs'; @@ -65,7 +65,7 @@ const mockItemWithoutMetadata: ItemSearchResult = Object.assign(new ItemSearchRe }); describe('ItemListElementComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ItemSearchResultListElementComponent, TruncatePipe], providers: [ @@ -78,7 +78,7 @@ describe('ItemListElementComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(ItemSearchResultListElementComponent); publicationListElementComponent = fixture.componentInstance; diff --git a/src/app/shared/object-list/selectable-list/selectable-list.reducer.spec.ts b/src/app/shared/object-list/selectable-list/selectable-list.reducer.spec.ts index 29b60cdc02..6e23fbacd0 100644 --- a/src/app/shared/object-list/selectable-list/selectable-list.reducer.spec.ts +++ b/src/app/shared/object-list/selectable-list/selectable-list.reducer.spec.ts @@ -1,6 +1,7 @@ import { SelectableListAction, - SelectableListDeselectAction, SelectableListDeselectAllAction, + SelectableListDeselectAction, + SelectableListDeselectAllAction, SelectableListDeselectSingleAction, SelectableListSelectAction, SelectableListSelectSingleAction, diff --git a/src/app/shared/object-list/selectable-list/selectable-list.service.spec.ts b/src/app/shared/object-list/selectable-list/selectable-list.service.spec.ts index 2d4137f031..348ee4d216 100644 --- a/src/app/shared/object-list/selectable-list/selectable-list.service.spec.ts +++ b/src/app/shared/object-list/selectable-list/selectable-list.service.spec.ts @@ -1,5 +1,5 @@ import { Store } from '@ngrx/store'; -import { async, TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { SelectableListService } from './selectable-list.service'; import { ListableObject } from '../../object-collection/shared/listable-object.model'; import { hasValue } from '../../empty.util'; @@ -43,7 +43,7 @@ describe('SelectableListService', () => { dispatch: {}, /* tslint:enable:no-empty */ }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ providers: [ diff --git a/src/app/shared/object-list/sidebar-search-list-element/sidebar-search-list-element.component.spec.ts b/src/app/shared/object-list/sidebar-search-list-element/sidebar-search-list-element.component.spec.ts index f7ec05df95..3d402ca0e4 100644 --- a/src/app/shared/object-list/sidebar-search-list-element/sidebar-search-list-element.component.spec.ts +++ b/src/app/shared/object-list/sidebar-search-list-element/sidebar-search-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { VarDirective } from '../../utils/var.directive'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; @@ -26,7 +26,7 @@ export function createSidebarSearchListElementTests( let linkService; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { linkService = jasmine.createSpyObj('linkService', { resolveLink: Object.assign(new HALResource(), { [object.indexableObject.getParentLinkKey()]: createSuccessfulRemoteDataObject$(parent) diff --git a/src/app/shared/object-list/type-badge/type-badge.component.spec.ts b/src/app/shared/object-list/type-badge/type-badge.component.spec.ts index e516fe353e..a8659e28ac 100644 --- a/src/app/shared/object-list/type-badge/type-badge.component.spec.ts +++ b/src/app/shared/object-list/type-badge/type-badge.component.spec.ts @@ -1,6 +1,6 @@ import { Item } from '../../../core/shared/item.model'; import { of as observableOf } from 'rxjs'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { TruncatePipe } from '../../utils/truncate.pipe'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; @@ -37,7 +37,7 @@ const mockItemWithoutRelationshipType = Object.assign(new Item(), { }); describe('ItemTypeBadgeComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], declarations: [TypeBadgeComponent, TruncatePipe], @@ -47,7 +47,7 @@ describe('ItemTypeBadgeComponent', () => { }).compileComponents(); })); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(TypeBadgeComponent); comp = fixture.componentInstance; })); diff --git a/src/app/shared/object-select/collection-select/collection-select.component.spec.ts b/src/app/shared/object-select/collection-select/collection-select.component.spec.ts index 8ef5f985ed..fd4a239cc4 100644 --- a/src/app/shared/object-select/collection-select/collection-select.component.spec.ts +++ b/src/app/shared/object-select/collection-select/collection-select.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { PaginationComponentOptions } from '../../pagination/pagination-component-options.model'; import { TranslateModule } from '@ngx-translate/core'; @@ -36,7 +36,7 @@ describe('CollectionSelectComponent', () => { currentPage: 1 }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), SharedModule, RouterTestingModule.withRoutes([])], declarations: [], @@ -69,7 +69,7 @@ describe('CollectionSelectComponent', () => { checkbox = fixture.debugElement.query(By.css('input.collection-checkbox')).nativeElement; }); - it('should initially be unchecked',() => { + it('should initially be unchecked', () => { expect(checkbox.checked).toBeFalsy(); }); @@ -94,7 +94,7 @@ describe('CollectionSelectComponent', () => { spyOn(comp.confirm, 'emit').and.callThrough(); }); - it('should emit the selected collections',() => { + it('should emit the selected collections', () => { confirmButton.click(); expect(comp.confirm.emit).toHaveBeenCalled(); }); @@ -108,7 +108,7 @@ describe('CollectionSelectComponent', () => { spyOn(comp.cancel, 'emit').and.callThrough(); }); - it('should emit a cancel event',() => { + it('should emit a cancel event', () => { cancelButton.click(); expect(comp.cancel.emit).toHaveBeenCalled(); }); diff --git a/src/app/shared/object-select/item-select/item-select.component.spec.ts b/src/app/shared/object-select/item-select/item-select.component.spec.ts index 39e674ad4a..f99991f391 100644 --- a/src/app/shared/object-select/item-select/item-select.component.spec.ts +++ b/src/app/shared/object-select/item-select/item-select.component.spec.ts @@ -1,5 +1,5 @@ import { ItemSelectComponent } from './item-select.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { Item } from '../../../core/shared/item.model'; import { PaginationComponentOptions } from '../../pagination/pagination-component-options.model'; @@ -59,7 +59,7 @@ describe('ItemSelectComponent', () => { currentPage: 1 }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), SharedModule, RouterTestingModule.withRoutes([])], declarations: [], @@ -92,7 +92,7 @@ describe('ItemSelectComponent', () => { checkbox = fixture.debugElement.query(By.css('input.item-checkbox')).nativeElement; }); - it('should initially be unchecked',() => { + it('should initially be unchecked', () => { expect(checkbox.checked).toBeFalsy(); }); @@ -117,7 +117,7 @@ describe('ItemSelectComponent', () => { spyOn(comp.confirm, 'emit').and.callThrough(); }); - it('should emit the selected items',() => { + it('should emit the selected items', () => { confirmButton.click(); expect(comp.confirm.emit).toHaveBeenCalled(); }); @@ -131,7 +131,7 @@ describe('ItemSelectComponent', () => { spyOn(comp.cancel, 'emit').and.callThrough(); }); - it('should emit a cancel event',() => { + it('should emit a cancel event', () => { cancelButton.click(); expect(comp.cancel.emit).toHaveBeenCalled(); }); diff --git a/src/app/shared/object-select/object-select.reducer.spec.ts b/src/app/shared/object-select/object-select.reducer.spec.ts index 197cbed510..dce66f25dd 100644 --- a/src/app/shared/object-select/object-select.reducer.spec.ts +++ b/src/app/shared/object-select/object-select.reducer.spec.ts @@ -1,7 +1,10 @@ import { - ObjectSelectionDeselectAction, ObjectSelectionInitialDeselectAction, - ObjectSelectionInitialSelectAction, ObjectSelectionResetAction, - ObjectSelectionSelectAction, ObjectSelectionSwitchAction + ObjectSelectionDeselectAction, + ObjectSelectionInitialDeselectAction, + ObjectSelectionInitialSelectAction, + ObjectSelectionResetAction, + ObjectSelectionSelectAction, + ObjectSelectionSwitchAction } from './object-select.actions'; import { objectSelectionReducer } from './object-select.reducer'; diff --git a/src/app/shared/object.util.spec.ts b/src/app/shared/object.util.spec.ts index c910e59e97..9d7f9dee37 100644 --- a/src/app/shared/object.util.spec.ts +++ b/src/app/shared/object.util.spec.ts @@ -7,13 +7,13 @@ describe('Object Utils', () => { describe('deleteProperty', () => { it('should return object without property \'a\'', () => { - object = {a: 'a', b: 'b'}; - objectExpected = {b: 'b'}; + object = { a: 'a', b: 'b' }; + objectExpected = { b: 'b' }; expect(deleteProperty(object, 'a')).toEqual(objectExpected); }); it('should return same object', () => { - object = {a: 'a', b: 'b'}; + object = { a: 'a', b: 'b' }; expect(deleteProperty(object, 'c')).toEqual(object); }); @@ -27,27 +27,27 @@ describe('Object Utils', () => { }); it('should return true when object has a null property', () => { - object = {a: null}; + object = { a: null }; expect(hasOnlyEmptyProperties(object)).toBe(true); }); it('should return true when object property has an empty array as value', () => { - object = {a: []}; + object = { a: [] }; expect(hasOnlyEmptyProperties(object)).toBe(true); }); it('should return true when object property has an empty object as value', () => { - object = {a: {}}; + object = { a: {} }; expect(hasOnlyEmptyProperties(object)).toBe(true); }); it('should return false when object is not empty', () => { - object = {a: 'a', b: 'b'}; + object = { a: 'a', b: 'b' }; expect(hasOnlyEmptyProperties(object)).toBe(false); }); it('should return false when object has at least a valued property', () => { - object = {a: [], b: 'b'}; + object = { a: [], b: 'b' }; expect(hasOnlyEmptyProperties(object)).toBe(false); }); @@ -63,22 +63,22 @@ describe('Object Utils', () => { }); it('should return object properties that are not included in the base object', () => { - object = {a: 'a', b: 'b'}; - anotherObject = {a: 'a'}; - objectExpected = {b: 'b'}; + object = { a: 'a', b: 'b' }; + anotherObject = { a: 'a' }; + objectExpected = { b: 'b' }; expect(difference(object, anotherObject)).toEqual(objectExpected); }); it('should not return object properties that are included only in the base object', () => { - object = {a: 'a'}; - anotherObject = {a: 'a', b: 'b'}; + object = { a: 'a' }; + anotherObject = { a: 'a', b: 'b' }; objectExpected = {}; expect(difference(object, anotherObject)).toEqual(objectExpected); }); it('should not return empty object properties that are not included in the base object', () => { - object = {a: 'a', b: {}}; - anotherObject = {a: 'a'}; + object = { a: 'a', b: {} }; + anotherObject = { a: 'a' }; objectExpected = {}; expect(difference(object, anotherObject)).toEqual(objectExpected); }); diff --git a/src/app/shared/page-size-selector/page-size-selector.component.spec.ts b/src/app/shared/page-size-selector/page-size-selector.component.spec.ts index be6bdf58c2..f75b5841af 100644 --- a/src/app/shared/page-size-selector/page-size-selector.component.spec.ts +++ b/src/app/shared/page-size-selector/page-size-selector.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { of as observableOf } from 'rxjs'; import { TranslateModule } from '@ngx-translate/core'; import { RouterTestingModule } from '@angular/router/testing'; @@ -40,7 +40,7 @@ describe('PageSizeSelectorComponent', () => { }) }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([])], declarations: [PageSizeSelectorComponent, EnumKeysPipe, VarDirective], diff --git a/src/app/shared/pagination/pagination.component.spec.ts b/src/app/shared/pagination/pagination.component.spec.ts index be8eb2c2fd..684ffb55e8 100644 --- a/src/app/shared/pagination/pagination.component.spec.ts +++ b/src/app/shared/pagination/pagination.component.spec.ts @@ -1,36 +1,22 @@ // Load the implementations that should be tested import { CommonModule } from '@angular/common'; -import { - ChangeDetectorRef, - Component, - CUSTOM_ELEMENTS_SCHEMA, - DebugElement -} from '@angular/core'; +import { ChangeDetectorRef, Component, CUSTOM_ELEMENTS_SCHEMA, DebugElement } from '@angular/core'; -import { - async, - ComponentFixture, - inject, - TestBed, fakeAsync, tick -} from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, inject, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { By } from '@angular/platform-browser'; -import { Observable } from 'rxjs'; - -import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; +import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { StoreModule } from '@ngrx/store'; import { NgxPaginationModule } from 'ngx-pagination'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; -import Spy = jasmine.Spy; - import { PaginationComponent } from './pagination.component'; import { PaginationComponentOptions } from './pagination-component-options.model'; @@ -122,8 +108,8 @@ describe('Pagination component', () => { // Define initial state and test state const _initialState = { width: 1600, height: 770 }; - // async beforeEach - beforeEach(async(() => { + // waitForAsync beforeEach + beforeEach(waitForAsync(() => { activatedRouteStub = new MockActivatedRoute(); routerStub = new RouterMock(); hostWindowServiceStub = new HostWindowServiceMock(_initialState.width); @@ -261,7 +247,15 @@ describe('Pagination component', () => { changePage(testFixture, 3); tick(); - expect(routerStub.navigate).toHaveBeenCalledWith([], { queryParams: { pageId: 'test', page: '3', pageSize: 10, sortDirection: 'ASC', sortField: 'dc.title' }, queryParamsHandling: 'merge' }); + expect(routerStub.navigate).toHaveBeenCalledWith([], { + queryParams: { + pageId: 'test', + page: '3', + pageSize: 10, + sortDirection: 'ASC', + sortField: 'dc.title' + }, queryParamsHandling: 'merge' + }); })); @@ -272,7 +266,15 @@ describe('Pagination component', () => { changePageSize(testFixture, '20'); tick(); - expect(routerStub.navigate).toHaveBeenCalledWith([], { queryParams: { pageId: 'test', page: 1, pageSize: 20, sortDirection: 'ASC', sortField: 'dc.title' } , queryParamsHandling: 'merge' }); + expect(routerStub.navigate).toHaveBeenCalledWith([], { + queryParams: { + pageId: 'test', + page: 1, + pageSize: 20, + sortDirection: 'ASC', + sortField: 'dc.title' + }, queryParamsHandling: 'merge' + }); })); it('should set correct values', fakeAsync(() => { diff --git a/src/app/shared/resource-policies/create/resource-policy-create.component.spec.ts b/src/app/shared/resource-policies/create/resource-policy-create.component.spec.ts index d11e884d7b..e1ffb00de0 100644 --- a/src/app/shared/resource-policies/create/resource-policy-create.component.spec.ts +++ b/src/app/shared/resource-policies/create/resource-policy-create.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { ChangeDetectorRef, Component, Injector, NO_ERRORS_SCHEMA } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; @@ -87,7 +87,7 @@ describe('ResourcePolicyCreateComponent test suite', () => { url: `url/edit` }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot() diff --git a/src/app/shared/resource-policies/edit/resource-policy-edit.component.spec.ts b/src/app/shared/resource-policies/edit/resource-policy-edit.component.spec.ts index c0ea12f17f..e9d1edbdc5 100644 --- a/src/app/shared/resource-policies/edit/resource-policy-edit.component.spec.ts +++ b/src/app/shared/resource-policies/edit/resource-policy-edit.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { ChangeDetectorRef, Component, Injector, NO_ERRORS_SCHEMA } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; @@ -7,10 +7,7 @@ import { of as observableOf } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; import { TranslateModule } from '@ngx-translate/core'; -import { - createFailedRemoteDataObject, - createSuccessfulRemoteDataObject -} from '../../remote-data.utils'; +import { createFailedRemoteDataObject, createSuccessfulRemoteDataObject } from '../../remote-data.utils'; import { createTestComponent } from '../../testing/utils.test'; import { LinkService } from '../../../core/cache/builders/link.service'; import { NotificationsService } from '../../notifications/notifications.service'; @@ -72,7 +69,7 @@ describe('ResourcePolicyEditComponent test suite', () => { url: `url/edit` }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot() diff --git a/src/app/shared/resource-policies/form/eperson-group-list/eperson-search-box/eperson-search-box.component.spec.ts b/src/app/shared/resource-policies/form/eperson-group-list/eperson-search-box/eperson-search-box.component.spec.ts index a4c40d4dd4..311d911b26 100644 --- a/src/app/shared/resource-policies/form/eperson-group-list/eperson-search-box/eperson-search-box.component.spec.ts +++ b/src/app/shared/resource-policies/form/eperson-group-list/eperson-search-box/eperson-search-box.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { Component, NO_ERRORS_SCHEMA } from '@angular/core'; import { FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms'; @@ -15,7 +15,7 @@ describe('EpersonSearchBoxComponent test suite', () => { let de; let formBuilder: FormBuilder; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ FormsModule, diff --git a/src/app/shared/resource-policies/form/eperson-group-list/group-search-box/group-search-box.component.spec.ts b/src/app/shared/resource-policies/form/eperson-group-list/group-search-box/group-search-box.component.spec.ts index 687e7c7bac..dc39e30d3b 100644 --- a/src/app/shared/resource-policies/form/eperson-group-list/group-search-box/group-search-box.component.spec.ts +++ b/src/app/shared/resource-policies/form/eperson-group-list/group-search-box/group-search-box.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { Component, NO_ERRORS_SCHEMA } from '@angular/core'; import { FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms'; @@ -15,7 +15,7 @@ describe('GroupSearchBoxComponent test suite', () => { let de; let formBuilder: FormBuilder; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ FormsModule, diff --git a/src/app/shared/resource-policies/resource-policies.component.spec.ts b/src/app/shared/resource-policies/resource-policies.component.spec.ts index 3b31c5b38b..894949ba47 100644 --- a/src/app/shared/resource-policies/resource-policies.component.spec.ts +++ b/src/app/shared/resource-policies/resource-policies.component.spec.ts @@ -15,10 +15,7 @@ import { Bundle } from '../../core/shared/bundle.model'; import { Item } from '../../core/shared/item.model'; import { LinkService } from '../../core/cache/builders/link.service'; import { getMockLinkService } from '../mocks/link-service.mock'; -import { - createSuccessfulRemoteDataObject, - createSuccessfulRemoteDataObject$ -} from '../remote-data.utils'; +import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../remote-data.utils'; import { createPaginatedList, createTestComponent } from '../testing/utils.test'; import { EPersonDataService } from '../../core/eperson/eperson-data.service'; import { NotificationsService } from '../notifications/notifications.service'; diff --git a/src/app/shared/search-form/search-form.component.spec.ts b/src/app/shared/search-form/search-form.component.spec.ts index 45339d98d2..f2293afeca 100644 --- a/src/app/shared/search-form/search-form.component.spec.ts +++ b/src/app/shared/search-form/search-form.component.spec.ts @@ -1,4 +1,4 @@ -import { ComponentFixture, TestBed, async, tick, fakeAsync } from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { DebugElement } from '@angular/core'; import { SearchFormComponent } from './search-form.component'; @@ -15,7 +15,7 @@ describe('SearchFormComponent', () => { let de: DebugElement; let el: HTMLElement; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [FormsModule, RouterTestingModule, TranslateModule.forRoot()], providers: [ diff --git a/src/app/shared/search/paginated-search-options.model.spec.ts b/src/app/shared/search/paginated-search-options.model.spec.ts index c8bef4b721..b75d2b8fab 100644 --- a/src/app/shared/search/paginated-search-options.model.spec.ts +++ b/src/app/shared/search/paginated-search-options.model.spec.ts @@ -13,7 +13,14 @@ describe('PaginatedSearchOptions', () => { const scope = '0fde1ecb-82cc-425a-b600-ac3576d76b47'; const baseUrl = 'www.rest.com'; beforeEach(() => { - options = new PaginatedSearchOptions({sort: sortOptions, pagination: pageOptions, filters: filters, query: query, scope: scope, dsoTypes: [DSpaceObjectType.ITEM]}); + options = new PaginatedSearchOptions({ + sort: sortOptions, + pagination: pageOptions, + filters: filters, + query: query, + scope: scope, + dsoTypes: [DSpaceObjectType.ITEM] + }); }); describe('when toRestUrl is called', () => { diff --git a/src/app/shared/search/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.spec.ts b/src/app/shared/search/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.spec.ts index a8c1b13ce4..4b2e5d2344 100644 --- a/src/app/shared/search/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.spec.ts +++ b/src/app/shared/search/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; @@ -81,7 +81,7 @@ describe('SearchFacetOptionComponent', () => { let router; const page = observableOf(0); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), NoopAnimationsModule, FormsModule], declarations: [SearchFacetOptionComponent], diff --git a/src/app/shared/search/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.spec.ts b/src/app/shared/search/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.spec.ts index 4a9502f53e..f5df1f038a 100644 --- a/src/app/shared/search/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.spec.ts +++ b/src/app/shared/search/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { SearchFilterConfig } from '../../../../search-filter-config.model'; @@ -54,7 +54,7 @@ describe('SearchFacetRangeOptionComponent', () => { let router; const page = observableOf(0); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), NoopAnimationsModule, FormsModule], declarations: [SearchFacetRangeOptionComponent], diff --git a/src/app/shared/search/search-filters/search-filter/search-facet-filter-options/search-facet-selected-option/search-facet-selected-option.component.spec.ts b/src/app/shared/search/search-filters/search-filter/search-facet-filter-options/search-facet-selected-option/search-facet-selected-option.component.spec.ts index 4837783a10..69945d86f2 100644 --- a/src/app/shared/search/search-filters/search-filter/search-facet-filter-options/search-facet-selected-option/search-facet-selected-option.component.spec.ts +++ b/src/app/shared/search/search-filters/search-filter/search-facet-filter-options/search-facet-selected-option/search-facet-selected-option.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { Router } from '@angular/router'; @@ -106,7 +106,7 @@ describe('SearchFacetSelectedOptionComponent', () => { let router; const page = observableOf(0); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), NoopAnimationsModule, FormsModule], declarations: [SearchFacetSelectedOptionComponent], diff --git a/src/app/shared/search/search-filters/search-filter/search-facet-filter/search-facet-filter.component.spec.ts b/src/app/shared/search/search-filters/search-filter/search-facet-filter/search-facet-filter.component.spec.ts index e4f59240bc..a8081e8f2d 100644 --- a/src/app/shared/search/search-filters/search-filter/search-facet-filter/search-facet-filter.component.spec.ts +++ b/src/app/shared/search/search-filters/search-filter/search-facet-filter/search-facet-filter.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { @@ -86,7 +86,7 @@ describe('SearchFacetFilterComponent', () => { const page = observableOf(0); const mockValues = createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), values)); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), NoopAnimationsModule, FormsModule], declarations: [SearchFacetFilterComponent], diff --git a/src/app/shared/search/search-filters/search-filter/search-filter.component.spec.ts b/src/app/shared/search/search-filters/search-filter/search-filter.component.spec.ts index fc394466d9..228eef9a20 100644 --- a/src/app/shared/search/search-filters/search-filter/search-filter.component.spec.ts +++ b/src/app/shared/search/search-filters/search-filter/search-filter.component.spec.ts @@ -1,6 +1,6 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; import { Observable, of as observableOf } from 'rxjs'; @@ -55,7 +55,7 @@ describe('SearchFilterComponent', () => { getFacetValuesFor: (filter) => mockResults }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), NoopAnimationsModule], declarations: [SearchFilterComponent], diff --git a/src/app/shared/search/search-filters/search-filter/search-filter.reducer.spec.ts b/src/app/shared/search/search-filters/search-filter/search-filter.reducer.spec.ts index 2f3268fba5..ae8108662d 100644 --- a/src/app/shared/search/search-filters/search-filter/search-filter.reducer.spec.ts +++ b/src/app/shared/search/search-filters/search-filter/search-filter.reducer.spec.ts @@ -1,8 +1,12 @@ import * as deepFreeze from 'deep-freeze'; import { - SearchFilterCollapseAction, SearchFilterExpandAction, SearchFilterIncrementPageAction, - SearchFilterToggleAction, - SearchFilterDecrementPageAction, SearchFilterResetPageAction, SearchFilterInitializeAction + SearchFilterCollapseAction, + SearchFilterDecrementPageAction, + SearchFilterExpandAction, + SearchFilterIncrementPageAction, + SearchFilterInitializeAction, + SearchFilterResetPageAction, + SearchFilterToggleAction } from './search-filter.actions'; import { filterReducer } from './search-filter.reducer'; @@ -99,7 +103,7 @@ describe('filterReducer', () => { it('should set filterCollapsed to true in response to the INITIALIZE action with isOpenByDefault to false when no state has been set for this filter', () => { const state = {}; state[filterName2] = { filterCollapsed: false, page: 1 }; - const filterConfig = {isOpenByDefault: false, name: filterName1} as any; + const filterConfig = { isOpenByDefault: false, name: filterName1 } as any; const action = new SearchFilterInitializeAction(filterConfig); const newState = filterReducer(state, action); @@ -109,7 +113,7 @@ describe('filterReducer', () => { it('should set filterCollapsed to false in response to the INITIALIZE action with isOpenByDefault to true when no state has been set for this filter', () => { const state = {}; state[filterName2] = { filterCollapsed: true, page: 1 }; - const filterConfig = {isOpenByDefault: true, name: filterName1} as any; + const filterConfig = { isOpenByDefault: true, name: filterName1 } as any; const action = new SearchFilterInitializeAction(filterConfig); const newState = filterReducer(state, action); expect(newState[filterName1].filterCollapsed).toEqual(false); diff --git a/src/app/shared/search/search-filters/search-filter/search-range-filter/search-range-filter.component.spec.ts b/src/app/shared/search/search-filters/search-filter/search-range-filter/search-range-filter.component.spec.ts index fd4abcca7f..598a397fe7 100644 --- a/src/app/shared/search/search-filters/search-filter/search-range-filter/search-range-filter.component.spec.ts +++ b/src/app/shared/search/search-filters/search-filter/search-range-filter/search-range-filter.component.spec.ts @@ -1,8 +1,12 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { FILTER_CONFIG, IN_PLACE_SEARCH, SearchFilterService } from '../../../../../core/shared/search/search-filter.service'; +import { + FILTER_CONFIG, + IN_PLACE_SEARCH, + SearchFilterService +} from '../../../../../core/shared/search/search-filter.service'; import { SearchFilterConfig } from '../../../search-filter-config.model'; import { FilterType } from '../../../filter-type.model'; import { FacetValue } from '../../../facet-value.model'; @@ -47,7 +51,7 @@ describe('SearchRangeFilterComponent', () => { count: 52, _links: { self: { - href:'' + href: '' }, search: { href: '' @@ -59,7 +63,7 @@ describe('SearchRangeFilterComponent', () => { count: 20, _links: { self: { - href:'' + href: '' }, search: { href: '' @@ -71,7 +75,7 @@ describe('SearchRangeFilterComponent', () => { count: 5, _links: { self: { - href:'' + href: '' }, search: { href: '' @@ -88,7 +92,7 @@ describe('SearchRangeFilterComponent', () => { const page = observableOf(0); const mockValues = createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), values)); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), NoopAnimationsModule, FormsModule], declarations: [SearchRangeFilterComponent], @@ -96,8 +100,8 @@ describe('SearchRangeFilterComponent', () => { { provide: SearchService, useValue: new SearchServiceStub(searchLink) }, { provide: Router, useValue: new RouterStub() }, { provide: FILTER_CONFIG, useValue: mockFilterConfig }, - { provide: RemoteDataBuildService, useValue: {aggregate: () => observableOf({})} }, - { provide: RouteService, useValue: {getQueryParameterValue: () => observableOf({})} }, + { provide: RemoteDataBuildService, useValue: { aggregate: () => observableOf({}) } }, + { provide: RouteService, useValue: { getQueryParameterValue: () => observableOf({}) } }, { provide: SEARCH_CONFIG_SERVICE, useValue: new SearchConfigurationServiceStub() }, { provide: IN_PLACE_SEARCH, useValue: false }, { diff --git a/src/app/shared/search/search-filters/search-filters.component.spec.ts b/src/app/shared/search/search-filters/search-filters.component.spec.ts index bceea8df03..aaea82df27 100644 --- a/src/app/shared/search/search-filters/search-filters.component.spec.ts +++ b/src/app/shared/search/search-filters/search-filters.component.spec.ts @@ -1,6 +1,6 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; @@ -32,7 +32,7 @@ describe('SearchFiltersComponent', () => { [] }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), NoopAnimationsModule], declarations: [SearchFiltersComponent], diff --git a/src/app/shared/search/search-labels/search-label/search-label.component.spec.ts b/src/app/shared/search/search-labels/search-label/search-label.component.spec.ts index 5fe60c775f..00868a86a2 100644 --- a/src/app/shared/search/search-labels/search-label/search-label.component.spec.ts +++ b/src/app/shared/search/search-labels/search-label/search-label.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TranslateModule } from '@ngx-translate/core'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; @@ -33,14 +33,14 @@ describe('SearchLabelComponent', () => { filter2 ]; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), NoopAnimationsModule, FormsModule], declarations: [SearchLabelComponent, ObjectKeysPipe], providers: [ { provide: SearchService, useValue: new SearchServiceStub(searchLink) }, { provide: SEARCH_CONFIG_SERVICE, useValue: new SearchConfigurationServiceStub() }, - { provide: Router, useValue: {}} + { provide: Router, useValue: {} } // { provide: SearchConfigurationService, useValue: {getCurrentFrontendFilters : () => observableOf({})} } ], schemas: [NO_ERRORS_SCHEMA] diff --git a/src/app/shared/search/search-labels/search-labels.component.spec.ts b/src/app/shared/search/search-labels/search-labels.component.spec.ts index 872a129b6c..f96ba56279 100644 --- a/src/app/shared/search/search-labels/search-labels.component.spec.ts +++ b/src/app/shared/search/search-labels/search-labels.component.spec.ts @@ -1,5 +1,5 @@ import { SearchLabelsComponent } from './search-labels.component'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TranslateModule } from '@ngx-translate/core'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; @@ -29,7 +29,7 @@ describe('SearchLabelsComponent', () => { filter2 ]; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), NoopAnimationsModule, FormsModule, RouterTestingModule], declarations: [SearchLabelsComponent, ObjectKeysPipe], diff --git a/src/app/shared/search/search-options.model.spec.ts b/src/app/shared/search/search-options.model.spec.ts index 7982eba6d3..62fe732218 100644 --- a/src/app/shared/search/search-options.model.spec.ts +++ b/src/app/shared/search/search-options.model.spec.ts @@ -10,7 +10,7 @@ describe('SearchOptions', () => { const scope = '0fde1ecb-82cc-425a-b600-ac3576d76b47'; const baseUrl = 'www.rest.com'; beforeEach(() => { - options = new SearchOptions({ filters: filters, query: query, scope: scope , dsoTypes: [DSpaceObjectType.ITEM]}); + options = new SearchOptions({ filters: filters, query: query, scope: scope, dsoTypes: [DSpaceObjectType.ITEM] }); }); describe('when toRestUrl is called', () => { diff --git a/src/app/shared/search/search-results/search-results.component.spec.ts b/src/app/shared/search/search-results/search-results.component.spec.ts index d6833773d6..f52cdfa1b0 100644 --- a/src/app/shared/search/search-results/search-results.component.spec.ts +++ b/src/app/shared/search/search-results/search-results.component.spec.ts @@ -1,4 +1,4 @@ -import { ComponentFixture, TestBed, async } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; @@ -14,7 +14,7 @@ describe('SearchResultsComponent', () => { let heading: DebugElement; let title: DebugElement; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), NoopAnimationsModule], declarations: [ diff --git a/src/app/shared/search/search-sidebar/search-sidebar.component.spec.ts b/src/app/shared/search/search-sidebar/search-sidebar.component.spec.ts index f05b33ff88..a16387cf51 100644 --- a/src/app/shared/search/search-sidebar/search-sidebar.component.spec.ts +++ b/src/app/shared/search/search-sidebar/search-sidebar.component.spec.ts @@ -1,5 +1,4 @@ - -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { SearchSidebarComponent } from './search-sidebar.component'; import { NgbCollapseModule } from '@ng-bootstrap/ng-bootstrap'; @@ -9,8 +8,8 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; describe('SearchSidebarComponent', () => { let comp: SearchSidebarComponent; let fixture: ComponentFixture; - // async beforeEach - beforeEach(async(() => { + // waitForAsync beforeEach + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), NgbCollapseModule], declarations: [SearchSidebarComponent], diff --git a/src/app/shared/search/search-switch-configuration/search-switch-configuration.component.spec.ts b/src/app/shared/search/search-switch-configuration/search-switch-configuration.component.spec.ts index e796571102..8796442d9f 100644 --- a/src/app/shared/search/search-switch-configuration/search-switch-configuration.component.spec.ts +++ b/src/app/shared/search/search-switch-configuration/search-switch-configuration.component.spec.ts @@ -1,5 +1,5 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { of as observableOf } from 'rxjs'; @@ -10,10 +10,7 @@ import { NavigationExtras, Router } from '@angular/router'; import { SearchConfigurationServiceStub } from '../../testing/search-configuration-service.stub'; import { RouterStub } from '../../testing/router.stub'; import { SearchService } from '../../../core/shared/search/search.service'; -import { - MYDSPACE_ROUTE, - SEARCH_CONFIG_SERVICE -} from '../../../+my-dspace-page/my-dspace-page.component'; +import { MYDSPACE_ROUTE, SEARCH_CONFIG_SERVICE } from '../../../+my-dspace-page/my-dspace-page.component'; import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspace-configuration-value-type'; import { TranslateLoaderMock } from '../../mocks/translate-loader.mock'; @@ -25,10 +22,10 @@ describe('SearchSwitchConfigurationComponent', () => { let select: any; const searchServiceStub = jasmine.createSpyObj('SearchService', { - getSearchLink: jasmine.createSpy('getSearchLink') + getSearchLink: jasmine.createSpy('getSearchLink') }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot({ @@ -38,13 +35,13 @@ describe('SearchSwitchConfigurationComponent', () => { } }) ], - declarations: [ SearchSwitchConfigurationComponent ], + declarations: [SearchSwitchConfigurationComponent], providers: [ { provide: Router, useValue: new RouterStub() }, { provide: SearchService, useValue: searchServiceStub }, { provide: SEARCH_CONFIG_SERVICE, useValue: new SearchConfigurationServiceStub() }, ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).compileComponents(); })); @@ -100,7 +97,7 @@ describe('SearchSwitchConfigurationComponent', () => { spyOn((comp as any), 'getSearchLinkParts').and.returnValue([MYDSPACE_ROUTE]); comp.selectedOption = MyDSpaceConfigurationValueType.Workflow; const navigationExtras: NavigationExtras = { - queryParams: {configuration: MyDSpaceConfigurationValueType.Workflow}, + queryParams: { configuration: MyDSpaceConfigurationValueType.Workflow }, }; fixture.detectChanges(); diff --git a/src/app/shared/search/search.utils.spec.ts b/src/app/shared/search/search.utils.spec.ts index 3690b1357d..ca4b4894b1 100644 --- a/src/app/shared/search/search.utils.spec.ts +++ b/src/app/shared/search/search.utils.spec.ts @@ -2,9 +2,9 @@ import { FacetValue } from './facet-value.model'; import { SearchFilterConfig } from './search-filter-config.model'; import { addOperatorToFilterValue, + escapeRegExp, getFacetValueForType, - stripOperatorFromFilterValue, - escapeRegExp + stripOperatorFromFilterValue } from './search.utils'; describe('Search Utils', () => { diff --git a/src/app/shared/sidebar/filter/sidebar-filter.service.spec.ts b/src/app/shared/sidebar/filter/sidebar-filter.service.spec.ts index 6ed0813ddc..49192a2006 100644 --- a/src/app/shared/sidebar/filter/sidebar-filter.service.spec.ts +++ b/src/app/shared/sidebar/filter/sidebar-filter.service.spec.ts @@ -22,13 +22,13 @@ describe('SidebarFilterService', () => { initialState = { sidebarFilter: { - filter_1 : { + filter_1: { filterCollapsed: true }, - filter_2 : { + filter_2: { filterCollapsed: false }, - filter_3 : { + filter_3: { filterCollapsed: true } } diff --git a/src/app/shared/sidebar/sidebar.reducer.spec.ts b/src/app/shared/sidebar/sidebar.reducer.spec.ts index 0fbfce84fc..796c40537c 100644 --- a/src/app/shared/sidebar/sidebar.reducer.spec.ts +++ b/src/app/shared/sidebar/sidebar.reducer.spec.ts @@ -1,10 +1,7 @@ import * as deepFreeze from 'deep-freeze'; import { sidebarReducer } from './sidebar.reducer'; -import { - SidebarCollapseAction, SidebarExpandAction, - SidebarToggleAction -} from './sidebar.actions'; +import { SidebarCollapseAction, SidebarExpandAction, SidebarToggleAction } from './sidebar.actions'; class NullAction extends SidebarCollapseAction { type = null; @@ -34,7 +31,7 @@ describe('sidebarReducer', () => { it('should set sidebarCollapsed to true in response to the COLLAPSE action', () => { const state = { sidebarCollapsed: false }; - const action = new SidebarCollapseAction(); + const action = new SidebarCollapseAction(); const newState = sidebarReducer(state, action); expect(newState.sidebarCollapsed).toEqual(true); @@ -44,7 +41,7 @@ describe('sidebarReducer', () => { const state = { sidebarCollapsed: false }; deepFreeze([state]); - const action = new SidebarCollapseAction(); + const action = new SidebarCollapseAction(); sidebarReducer(state, action); // no expect required, deepFreeze will ensure an exception is thrown if the state @@ -53,7 +50,7 @@ describe('sidebarReducer', () => { it('should set sidebarCollapsed to false in response to the EXPAND action', () => { const state = { sidebarCollapsed: true }; - const action = new SidebarExpandAction(); + const action = new SidebarExpandAction(); const newState = sidebarReducer(state, action); expect(newState.sidebarCollapsed).toEqual(false); @@ -63,13 +60,13 @@ describe('sidebarReducer', () => { const state = { sidebarCollapsed: true }; deepFreeze([state]); - const action = new SidebarExpandAction(); + const action = new SidebarExpandAction(); sidebarReducer(state, action); }); it('should flip the value of sidebarCollapsed in response to the TOGGLE action', () => { const state1 = { sidebarCollapsed: true }; - const action = new SidebarToggleAction(); + const action = new SidebarToggleAction(); const state2 = sidebarReducer(state1, action); const state3 = sidebarReducer(state2, action); @@ -82,7 +79,7 @@ describe('sidebarReducer', () => { const state = { sidebarCollapsed: true }; deepFreeze([state]); - const action = new SidebarToggleAction(); + const action = new SidebarToggleAction(); sidebarReducer(state, action); }); diff --git a/src/app/shared/sidebar/sidebar.service.spec.ts b/src/app/shared/sidebar/sidebar.service.spec.ts index 6d8e845836..d11a10ebe6 100644 --- a/src/app/shared/sidebar/sidebar.service.spec.ts +++ b/src/app/shared/sidebar/sidebar.service.spec.ts @@ -1,7 +1,7 @@ import { Store } from '@ngrx/store'; import { SidebarService } from './sidebar.service'; import { AppState } from '../../app.reducer'; -import { async, TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { of as observableOf } from 'rxjs'; import { SidebarCollapseAction, SidebarExpandAction } from './sidebar.actions'; import { HostWindowService } from '../host-window.service'; @@ -20,7 +20,7 @@ describe('SidebarService', () => { isSm: observableOf(false), isXsOrSm: observableOf(true) }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ providers: [ @@ -36,7 +36,7 @@ describe('SidebarService', () => { beforeEach(() => { service = new SidebarService(store, windowService); - }) ; + }); describe('when the collapse method is triggered', () => { beforeEach(() => { diff --git a/src/app/shared/starts-with/text/starts-with-text.component.spec.ts b/src/app/shared/starts-with/text/starts-with-text.component.spec.ts index bc9c21aab8..780c221294 100644 --- a/src/app/shared/starts-with/text/starts-with-text.component.spec.ts +++ b/src/app/shared/starts-with/text/starts-with-text.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ActivatedRoute, NavigationExtras, Router } from '@angular/router'; import { CommonModule } from '@angular/common'; import { RouterTestingModule } from '@angular/router/testing'; @@ -17,7 +17,7 @@ describe('StartsWithTextComponent', () => { const options = ['0-9', 'A', 'B', 'C']; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], declarations: [StartsWithTextComponent, EnumKeysPipe], diff --git a/src/app/shared/trackable/abstract-trackable.component.spec.ts b/src/app/shared/trackable/abstract-trackable.component.spec.ts index 3755092263..c538f074c5 100644 --- a/src/app/shared/trackable/abstract-trackable.component.spec.ts +++ b/src/app/shared/trackable/abstract-trackable.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { AbstractTrackableComponent } from './abstract-trackable.component'; import { INotification, Notification } from '../notifications/models/notification.model'; import { NotificationType } from '../notifications/models/notification-type'; @@ -30,7 +30,7 @@ describe('AbstractTrackableComponent', () => { const url = 'http://test-url.com/test-url'; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { objectUpdatesService = jasmine.createSpyObj('objectUpdatesService', { saveAddFieldUpdate: {}, @@ -49,8 +49,8 @@ describe('AbstractTrackableComponent', () => { imports: [TranslateModule.forRoot()], declarations: [AbstractTrackableComponent], providers: [ - {provide: ObjectUpdatesService, useValue: objectUpdatesService}, - {provide: NotificationsService, useValue: notificationsService}, + { provide: ObjectUpdatesService, useValue: objectUpdatesService }, + { provide: NotificationsService, useValue: notificationsService }, ], schemas: [ NO_ERRORS_SCHEMA ] @@ -83,7 +83,7 @@ describe('AbstractTrackableComponent', () => { it('should return an observable that emits true', () => { const expected = '(a|)'; - scheduler.expectObservable(comp.isReinstatable()).toBe(expected, {a: true}); + scheduler.expectObservable(comp.isReinstatable()).toBe(expected, { a: true }); }); }); @@ -94,7 +94,7 @@ describe('AbstractTrackableComponent', () => { it('should return an observable that emits true', () => { const expected = '(a|)'; - scheduler.expectObservable(comp.hasChanges()).toBe(expected, {a: true}); + scheduler.expectObservable(comp.hasChanges()).toBe(expected, { a: true }); }); }); diff --git a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.spec.ts b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.spec.ts index 414f9afec4..1b3cdad33e 100644 --- a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.spec.ts +++ b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { of as observableOf } from 'rxjs'; import { TruncatablePartComponent } from './truncatable-part.component'; import { TruncatableService } from '../truncatable.service'; @@ -21,7 +21,7 @@ describe('TruncatablePartComponent', () => { } } }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [TruncatablePartComponent], diff --git a/src/app/shared/truncatable/truncatable.component.spec.ts b/src/app/shared/truncatable/truncatable.component.spec.ts index 176beb0f15..b539ab0d56 100644 --- a/src/app/shared/truncatable/truncatable.component.spec.ts +++ b/src/app/shared/truncatable/truncatable.component.spec.ts @@ -1,5 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { of as observableOf } from 'rxjs'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { mockTruncatableService } from '../mocks/mock-trucatable.service'; import { TruncatableComponent } from './truncatable.component'; import { TruncatableService } from './truncatable.service'; @@ -11,7 +10,7 @@ describe('TruncatableComponent', () => { let fixture: ComponentFixture; const identifier = '1234567890'; let truncatableService; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule], declarations: [TruncatableComponent], diff --git a/src/app/shared/truncatable/truncatable.reducer.spec.ts b/src/app/shared/truncatable/truncatable.reducer.spec.ts index 00949d1113..841ec5e367 100644 --- a/src/app/shared/truncatable/truncatable.reducer.spec.ts +++ b/src/app/shared/truncatable/truncatable.reducer.spec.ts @@ -1,15 +1,14 @@ import * as deepFreeze from 'deep-freeze'; import { truncatableReducer } from './truncatable.reducer'; -import { - TruncatableCollapseAction, TruncatableExpandAction, - TruncatableToggleAction -} from './truncatable.actions'; +import { TruncatableCollapseAction, TruncatableExpandAction, TruncatableToggleAction } from './truncatable.actions'; const id1 = '123'; const id2 = '456'; + class NullAction extends TruncatableCollapseAction { type = null; + constructor() { super(undefined); } @@ -36,7 +35,7 @@ describe('truncatableReducer', () => { it('should set collapsed to true in response to the COLLAPSE action', () => { const state = {}; - state[id1] = { collapsed: false}; + state[id1] = { collapsed: false }; const action = new TruncatableCollapseAction(id1); const newState = truncatableReducer(state, action); @@ -45,7 +44,7 @@ describe('truncatableReducer', () => { it('should perform the COLLAPSE action without affecting the previous state', () => { const state = {}; - state[id1] = { collapsed: false}; + state[id1] = { collapsed: false }; deepFreeze([state]); const action = new TruncatableCollapseAction(id1); diff --git a/src/app/shared/truncatable/truncatable.service.spec.ts b/src/app/shared/truncatable/truncatable.service.spec.ts index 250cc4ba53..a93125ec4a 100644 --- a/src/app/shared/truncatable/truncatable.service.spec.ts +++ b/src/app/shared/truncatable/truncatable.service.spec.ts @@ -1,5 +1,5 @@ import { Store } from '@ngrx/store'; -import { async, TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { TruncatableService } from './truncatable.service'; import { TruncatableCollapseAction, TruncatableExpandAction } from './truncatable.actions'; import { TruncatablesState } from './truncatable.reducer'; @@ -15,7 +15,7 @@ describe('TruncatableService', () => { /* tslint:enable:no-empty */ select: observableOf(true) }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ providers: [ diff --git a/src/app/shared/uploader/uploader.component.spec.ts b/src/app/shared/uploader/uploader.component.spec.ts index f04738dce6..d33c27b897 100644 --- a/src/app/shared/uploader/uploader.component.spec.ts +++ b/src/app/shared/uploader/uploader.component.spec.ts @@ -1,6 +1,6 @@ // Load the implementations that should be tested import { ChangeDetectorRef, Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, inject, TestBed, } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync, } from '@angular/core/testing'; import { ScrollToService } from '@nicky-lenaers/ngx-scroll-to'; @@ -17,8 +17,8 @@ describe('Chips component', () => { let testFixture: ComponentFixture; let html; - // async beforeEach - beforeEach(async(() => { + // waitForAsync beforeEach + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ diff --git a/src/app/shared/utils/route.utils.spec.ts b/src/app/shared/utils/route.utils.spec.ts index 610fd8756d..7ec6c879d8 100644 --- a/src/app/shared/utils/route.utils.spec.ts +++ b/src/app/shared/utils/route.utils.spec.ts @@ -1,22 +1,22 @@ import { currentPath } from './route.utils'; describe('Route Utils', () => { - const urlTree = { - root: { - children: { - primary: { - segments: [ - { path: 'test' }, - { path: 'path' } - ] - } - + const urlTree = { + root: { + children: { + primary: { + segments: [ + { path: 'test' }, + { path: 'path' } + ] } + } - }; - const router = { parseUrl: () => urlTree } as any; - it('Should return the correct current path based on the router', () => { - const result = currentPath(router); - expect(result).toEqual('/test/path'); - }); + } + }; + const router = { parseUrl: () => urlTree } as any; + it('Should return the correct current path based on the router', () => { + const result = currentPath(router); + expect(result).toEqual('/test/path'); }); +}); diff --git a/src/app/shared/view-mode-switch/view-mode-switch.component.spec.ts b/src/app/shared/view-mode-switch/view-mode-switch.component.spec.ts index b0d29751ed..4eee7b1aba 100644 --- a/src/app/shared/view-mode-switch/view-mode-switch.component.spec.ts +++ b/src/app/shared/view-mode-switch/view-mode-switch.component.spec.ts @@ -1,5 +1,5 @@ -import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; -import { async, ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing'; +import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; +import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { TranslateLoaderMock } from '../mocks/translate-loader.mock'; import { RouterTestingModule } from '@angular/router/testing'; @@ -12,7 +12,8 @@ import { SearchServiceStub } from '../testing/search-service.stub'; import { ViewMode } from '../../core/shared/view-mode.model'; @Component({ template: '' }) -class DummyComponent { } +class DummyComponent { +} describe('ViewModeSwitchComponent', () => { let comp: ViewModeSwitchComponent; @@ -20,7 +21,7 @@ describe('ViewModeSwitchComponent', () => { const searchService = new SearchServiceStub(); let listButton: HTMLElement; let gridButton: HTMLElement; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot({ diff --git a/src/app/shared/vocabulary-treeview/vocabulary-treeview.service.spec.ts b/src/app/shared/vocabulary-treeview/vocabulary-treeview.service.spec.ts index d95f5593f0..ef84a290dd 100644 --- a/src/app/shared/vocabulary-treeview/vocabulary-treeview.service.spec.ts +++ b/src/app/shared/vocabulary-treeview/vocabulary-treeview.service.spec.ts @@ -1,4 +1,4 @@ -import { async, TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { TestScheduler } from 'rxjs/testing'; import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core'; @@ -8,12 +8,7 @@ import { VocabularyTreeviewService } from './vocabulary-treeview.service'; import { VocabularyService } from '../../core/submission/vocabularies/vocabulary.service'; import { TranslateLoaderMock } from '../mocks/translate-loader.mock'; import { VocabularyOptions } from '../../core/submission/vocabularies/models/vocabulary-options.model'; -import { - LOAD_MORE_NODE, - LOAD_MORE_ROOT_NODE, - TreeviewFlatNode, - TreeviewNode -} from './vocabulary-treeview-node.model'; +import { LOAD_MORE_NODE, LOAD_MORE_ROOT_NODE, TreeviewFlatNode, TreeviewNode } from './vocabulary-treeview-node.model'; import { PageInfo } from '../../core/shared/page-info.model'; import { VocabularyEntryDetail } from '../../core/submission/vocabularies/models/vocabulary-entry-detail.model'; import { buildPaginatedList } from '../../core/data/paginated-list.model'; @@ -164,7 +159,7 @@ describe('VocabularyTreeviewService test suite', () => { vocabularyOptions = new VocabularyOptions('vocabularyTest', false); } - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot({ diff --git a/src/app/statistics-page/collection-statistics-page/collection-statistics-page.component.spec.ts b/src/app/statistics-page/collection-statistics-page/collection-statistics-page.component.spec.ts index bcdd5b5641..ec91864e41 100644 --- a/src/app/statistics-page/collection-statistics-page/collection-statistics-page.component.spec.ts +++ b/src/app/statistics-page/collection-statistics-page/collection-statistics-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { CollectionStatisticsPageComponent } from './collection-statistics-page.component'; import { StatisticsTableComponent } from '../statistics-table/statistics-table.component'; import { TranslateModule } from '@ngx-translate/core'; @@ -22,7 +22,7 @@ describe('CollectionStatisticsPageComponent', () => { let de: DebugElement; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { const activatedRoute = { data: observableOf({ diff --git a/src/app/statistics-page/community-statistics-page/community-statistics-page.component.spec.ts b/src/app/statistics-page/community-statistics-page/community-statistics-page.component.spec.ts index c7f28adeff..275c22f760 100644 --- a/src/app/statistics-page/community-statistics-page/community-statistics-page.component.spec.ts +++ b/src/app/statistics-page/community-statistics-page/community-statistics-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { CommunityStatisticsPageComponent } from './community-statistics-page.component'; import { StatisticsTableComponent } from '../statistics-table/statistics-table.component'; import { TranslateModule } from '@ngx-translate/core'; @@ -22,7 +22,7 @@ describe('CommunityStatisticsPageComponent', () => { let de: DebugElement; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { const activatedRoute = { data: observableOf({ diff --git a/src/app/statistics-page/item-statistics-page/item-statistics-page.component.spec.ts b/src/app/statistics-page/item-statistics-page/item-statistics-page.component.spec.ts index 930871e5df..357f39ca96 100644 --- a/src/app/statistics-page/item-statistics-page/item-statistics-page.component.spec.ts +++ b/src/app/statistics-page/item-statistics-page/item-statistics-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { ItemStatisticsPageComponent } from './item-statistics-page.component'; import { StatisticsTableComponent } from '../statistics-table/statistics-table.component'; import { TranslateModule } from '@ngx-translate/core'; @@ -22,7 +22,7 @@ describe('ItemStatisticsPageComponent', () => { let de: DebugElement; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { const activatedRoute = { data: observableOf({ diff --git a/src/app/statistics-page/site-statistics-page/site-statistics-page.component.spec.ts b/src/app/statistics-page/site-statistics-page/site-statistics-page.component.spec.ts index 1a3babc570..dedc026df0 100644 --- a/src/app/statistics-page/site-statistics-page/site-statistics-page.component.spec.ts +++ b/src/app/statistics-page/site-statistics-page/site-statistics-page.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { SiteStatisticsPageComponent } from './site-statistics-page.component'; import { StatisticsTableComponent } from '../statistics-table/statistics-table.component'; import { TranslateModule } from '@ngx-translate/core'; @@ -22,7 +22,7 @@ describe('SiteStatisticsPageComponent', () => { let de: DebugElement; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { const activatedRoute = { }; diff --git a/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts b/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts index f22adea37d..c7900cd278 100644 --- a/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts +++ b/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { StatisticsTableComponent } from './statistics-table.component'; import { UsageReport } from '../../core/statistics/models/usage-report.model'; @@ -14,7 +14,7 @@ describe('StatisticsTableComponent', () => { let de: DebugElement; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot(), diff --git a/src/app/submission/edit/submission-edit.component.spec.ts b/src/app/submission/edit/submission-edit.component.spec.ts index ca413ea898..828edd00e8 100644 --- a/src/app/submission/edit/submission-edit.component.spec.ts +++ b/src/app/submission/edit/submission-edit.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { NO_ERRORS_SCHEMA } from '@angular/core'; @@ -29,7 +29,7 @@ describe('SubmissionEditComponent Component', () => { const route: ActivatedRouteStub = new ActivatedRouteStub(); const submissionObject: any = mockSubmissionObject; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot(), diff --git a/src/app/submission/form/submission-upload-files/submission-upload-files.component.spec.ts b/src/app/submission/form/submission-upload-files/submission-upload-files.component.spec.ts index 81e96bf8ad..4a943276e5 100644 --- a/src/app/submission/form/submission-upload-files/submission-upload-files.component.spec.ts +++ b/src/app/submission/form/submission-upload-files/submission-upload-files.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectorRef, Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, inject, TestBed } from '@angular/core/testing'; import { of as observableOf } from 'rxjs'; import { TranslateModule, TranslateService } from '@ngx-translate/core'; @@ -50,7 +50,7 @@ describe('SubmissionUploadFilesComponent Component', () => { select: jasmine.createSpy('select') }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ SharedModule, diff --git a/src/app/submission/import-external/import-external-collection/submission-import-external-collection.component.spec.ts b/src/app/submission/import-external/import-external-collection/submission-import-external-collection.component.spec.ts index 5002c4f94a..1247eda0dc 100644 --- a/src/app/submission/import-external/import-external-collection/submission-import-external-collection.component.spec.ts +++ b/src/app/submission/import-external/import-external-collection/submission-import-external-collection.component.spec.ts @@ -1,5 +1,5 @@ import { Component, NO_ERRORS_SCHEMA, EventEmitter } from '@angular/core'; -import { async, TestBed, ComponentFixture, inject } from '@angular/core/testing'; +import { waitForAsync, TestBed, ComponentFixture, inject } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { createTestComponent } from '../../../shared/testing/utils.test'; import { SubmissionImportExternalCollectionComponent } from './submission-import-external-collection.component'; @@ -11,7 +11,7 @@ describe('SubmissionImportExternalCollectionComponent test suite', () => { let compAsAny: any; let fixture: ComponentFixture; - beforeEach(async (() => { + beforeEach(waitForAsync (() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot(), diff --git a/src/app/submission/import-external/submission-import-external.component.spec.ts b/src/app/submission/import-external/submission-import-external.component.spec.ts index 2de8b5a839..3a69a3727e 100644 --- a/src/app/submission/import-external/submission-import-external.component.spec.ts +++ b/src/app/submission/import-external/submission-import-external.component.spec.ts @@ -1,5 +1,5 @@ import { Component, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, inject, TestBed } from '@angular/core/testing'; import { getTestScheduler } from 'jasmine-marbles'; import { TranslateModule } from '@ngx-translate/core'; @@ -41,7 +41,7 @@ describe('SubmissionImportExternalComponent test suite', () => { }; const mockExternalSourceService: any = getMockExternalSourceService(); - beforeEach(async (() => { + beforeEach(waitForAsync (() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot() diff --git a/src/app/submission/sections/container/section-container.component.spec.ts b/src/app/submission/sections/container/section-container.component.spec.ts index d88789b342..324582c0c9 100644 --- a/src/app/submission/sections/container/section-container.component.spec.ts +++ b/src/app/submission/sections/container/section-container.component.spec.ts @@ -59,7 +59,7 @@ describe('SubmissionSectionContainerComponent test suite', () => { submissionServiceStub.getActiveSectionId.and.returnValue(observableOf('traditionalpageone')); } - // async beforeEach + // waitForAsync beforeEach beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ diff --git a/src/app/submission/sections/form/section-form-operations.service.spec.ts b/src/app/submission/sections/form/section-form-operations.service.spec.ts index d6aaf2fe06..580e3a9928 100644 --- a/src/app/submission/sections/form/section-form-operations.service.spec.ts +++ b/src/app/submission/sections/form/section-form-operations.service.spec.ts @@ -1,4 +1,4 @@ -import { async, TestBed } from '@angular/core/testing'; +import { waitForAsync, TestBed } from '@angular/core/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { @@ -59,7 +59,7 @@ describe('SectionFormOperationsService test suite', () => { type: 'remove' }; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot({ diff --git a/src/app/submission/sections/sections.service.spec.ts b/src/app/submission/sections/sections.service.spec.ts index 93fdb77925..6bdf26a082 100644 --- a/src/app/submission/sections/sections.service.spec.ts +++ b/src/app/submission/sections/sections.service.spec.ts @@ -1,4 +1,4 @@ -import { async, TestBed } from '@angular/core/testing'; +import { waitForAsync, TestBed } from '@angular/core/testing'; import { cold, getTestScheduler } from 'jasmine-marbles'; import { of as observableOf } from 'rxjs'; @@ -59,7 +59,7 @@ describe('SectionsService test suite', () => { select: jasmine.createSpy('select') }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ StoreModule.forRoot({ submissionReducers } as any, storeModuleConfig), diff --git a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.spec.ts b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.spec.ts index accc8b05bb..919752f89f 100644 --- a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.spec.ts +++ b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectorRef, Component, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, inject, TestBed } from '@angular/core/testing'; import { BrowserModule } from '@angular/platform-browser'; import { CommonModule } from '@angular/common'; import { TranslateModule } from '@ngx-translate/core'; @@ -53,7 +53,7 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => { const fileId = '123456-test-upload'; const fileData: any = mockUploadFiles[0]; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ BrowserModule, diff --git a/src/app/submission/sections/upload/file/section-upload-file.component.spec.ts b/src/app/submission/sections/upload/file/section-upload-file.component.spec.ts index 34ba8fed4e..3dac142378 100644 --- a/src/app/submission/sections/upload/file/section-upload-file.component.spec.ts +++ b/src/app/submission/sections/upload/file/section-upload-file.component.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectorRef, Component, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, fakeAsync, inject, TestBed, tick } from '@angular/core/testing'; +import { ComponentFixture, fakeAsync, inject, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { BrowserModule, By } from '@angular/platform-browser'; import { CommonModule } from '@angular/common'; @@ -81,7 +81,7 @@ describe('SubmissionSectionUploadFileComponent test suite', () => { remove: jasmine.createSpy('remove'), }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ BrowserModule, diff --git a/src/app/submission/submission.service.spec.ts b/src/app/submission/submission.service.spec.ts index 396a129f5a..ccf46a0c38 100644 --- a/src/app/submission/submission.service.spec.ts +++ b/src/app/submission/submission.service.spec.ts @@ -1,5 +1,5 @@ import { StoreModule } from '@ngrx/store'; -import { async, fakeAsync, flush, TestBed, tick } from '@angular/core/testing'; +import { waitForAsync, fakeAsync, flush, TestBed, tick } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { HttpHeaders } from '@angular/common/http'; @@ -352,7 +352,7 @@ describe('SubmissionService test suite', () => { const requestServce = getMockRequestService(); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ diff --git a/src/app/submission/submit/submission-submit.component.spec.ts b/src/app/submission/submit/submission-submit.component.spec.ts index fda688c634..5a446f8b6b 100644 --- a/src/app/submission/submit/submission-submit.component.spec.ts +++ b/src/app/submission/submit/submission-submit.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing'; +import { waitForAsync, ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { NO_ERRORS_SCHEMA, ViewContainerRef } from '@angular/core'; @@ -26,7 +26,7 @@ describe('SubmissionSubmitComponent Component', () => { const submissionId = '826'; const submissionObject: any = mockSubmissionObject; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot(), diff --git a/src/app/thumbnail/thumbnail.component.spec.ts b/src/app/thumbnail/thumbnail.component.spec.ts index 53f2efd247..21678c9162 100644 --- a/src/app/thumbnail/thumbnail.component.spec.ts +++ b/src/app/thumbnail/thumbnail.component.spec.ts @@ -1,5 +1,5 @@ import { DebugElement } from '@angular/core'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { Bitstream } from '../core/shared/bitstream.model'; import { SafeUrlPipe } from '../shared/utils/safe-url-pipe'; @@ -12,7 +12,7 @@ describe('ThumbnailComponent', () => { let de: DebugElement; let el: HTMLElement; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ThumbnailComponent, SafeUrlPipe] }).compileComponents();