diff --git a/src/app/access-control/bulk-access/browse/bulk-access-browse.component.spec.ts b/src/app/access-control/bulk-access/browse/bulk-access-browse.component.spec.ts index f9eb487d73a..94c4527c99b 100644 --- a/src/app/access-control/bulk-access/browse/bulk-access-browse.component.spec.ts +++ b/src/app/access-control/bulk-access/browse/bulk-access-browse.component.spec.ts @@ -9,7 +9,7 @@ import { NgbNavModule, } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { buildPaginatedList } from '../../../core/data/paginated-list.model'; import { PageInfo } from '../../../core/shared/page-info.model'; @@ -70,7 +70,7 @@ describe('BulkAccessBrowseComponent', () => { beforeEach(() => { fixture = TestBed.createComponent(BulkAccessBrowseComponent); component = fixture.componentInstance; - (component as any).selectableListService.getSelectableList.and.returnValue(of(testSelection)); + (component as any).selectableListService.getSelectableList.and.returnValue(observableOf(testSelection)); fixture.detectChanges(); }); diff --git a/src/app/access-control/bulk-access/bulk-access.component.spec.ts b/src/app/access-control/bulk-access/bulk-access.component.spec.ts index 8bfbe1fe5d1..03b47c75a8c 100644 --- a/src/app/access-control/bulk-access/bulk-access.component.spec.ts +++ b/src/app/access-control/bulk-access/bulk-access.component.spec.ts @@ -5,7 +5,7 @@ import { } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { Process } from '../../process-page/processes/process.model'; import { BulkAccessControlService } from '../../shared/access-control-form-container/bulk-access-control.service'; @@ -113,7 +113,7 @@ describe('BulkAccessComponent', () => { beforeEach(() => { - (component as any).selectableListService.getSelectableList.and.returnValue(of(selectableListStateEmpty)); + (component as any).selectableListService.getSelectableList.and.returnValue(observableOf(selectableListStateEmpty)); fixture.detectChanges(); component.settings = mockSettings; }); @@ -136,7 +136,7 @@ describe('BulkAccessComponent', () => { beforeEach(() => { - (component as any).selectableListService.getSelectableList.and.returnValue(of(selectableListState)); + (component as any).selectableListService.getSelectableList.and.returnValue(observableOf(selectableListState)); fixture.detectChanges(); component.settings = mockSettings; }); diff --git a/src/app/access-control/group-registry/groups-registry.component.spec.ts b/src/app/access-control/group-registry/groups-registry.component.spec.ts index 43c72843e5b..a869dda6298 100644 --- a/src/app/access-control/group-registry/groups-registry.component.spec.ts +++ b/src/app/access-control/group-registry/groups-registry.component.spec.ts @@ -26,7 +26,6 @@ import { TranslateModule } from '@ngx-translate/core'; import { Observable, of as observableOf, - of, } from 'rxjs'; import { APP_DATA_SERVICES_MAP } from '../../../config/app-config.interface'; @@ -198,7 +197,7 @@ describe('GroupsRegistryComponent', () => { }; configurationDataService = jasmine.createSpyObj('ConfigurationDataService', { - findByPropertyName: of({ payload: { value: 'test' } }), + findByPropertyName: observableOf({ payload: { value: 'test' } }), }); authorizationService = jasmine.createSpyObj('authorizationService', ['isAuthorized']); diff --git a/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.spec.ts b/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.spec.ts index 2fd5cd872b9..fd09a89dbb4 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.spec.ts +++ b/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.spec.ts @@ -30,10 +30,7 @@ import { TranslateService, } from '@ngx-translate/core'; import { PaginationService } from 'ngx-pagination'; -import { - of as observableOf, - of, -} from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { RouteService } from '../../../core/services/route.service'; import { MockActivatedRoute } from '../../../shared/mocks/active-router.mock'; @@ -85,7 +82,7 @@ describe('LdnServiceFormEditComponent', () => { const translateServiceStub = { - get: () => of('translated-text'), + get: () => observableOf('translated-text'), instant: () => 'translated-text', onLangChange: new EventEmitter(), onTranslationChange: new EventEmitter(), @@ -100,7 +97,7 @@ describe('LdnServiceFormEditComponent', () => { }); ldnItemfiltersService = { - findAll: () => of(['item1', 'item2']), + findAll: () => observableOf(['item1', 'item2']), }; cdRefStub = Object.assign({ detectChanges: () => fixture.detectChanges(), diff --git a/src/app/admin/admin-ldn-services/ldn-service-serviceMock/ldnServicesRD$-mock.ts b/src/app/admin/admin-ldn-services/ldn-service-serviceMock/ldnServicesRD$-mock.ts index 8494b67dab6..be3b9095257 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-serviceMock/ldnServicesRD$-mock.ts +++ b/src/app/admin/admin-ldn-services/ldn-service-serviceMock/ldnServicesRD$-mock.ts @@ -1,6 +1,6 @@ import { Observable, - of, + of as observableOf, } from 'rxjs'; import { PaginatedList } from '../../../core/data/paginated-list.model'; @@ -112,4 +112,4 @@ export const mockLdnServices: LdnService[] = [{ }, }, ]; -export const mockLdnServicesRD$: Observable>> = of((mockLdnServices as unknown) as RemoteData>); +export const mockLdnServicesRD$: Observable>> = observableOf((mockLdnServices as unknown) as RemoteData>); diff --git a/src/app/admin/admin-ldn-services/ldn-services-data/ldn-itemfilter-data.service.spec.ts b/src/app/admin/admin-ldn-services/ldn-services-data/ldn-itemfilter-data.service.spec.ts index 110a0779fbd..8ac6ccab7f4 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-data/ldn-itemfilter-data.service.spec.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-data/ldn-itemfilter-data.service.spec.ts @@ -2,7 +2,7 @@ import { cold, getTestScheduler, } from 'jasmine-marbles'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service'; @@ -59,12 +59,12 @@ describe('LdnItemfiltersService test', () => { generateRequestId: requestUUID, send: true, removeByHrefSubstring: {}, - getByHref: of(responseCacheEntry), - getByUUID: of(responseCacheEntry), + getByHref: observableOf(responseCacheEntry), + getByUUID: observableOf(responseCacheEntry), }); halService = jasmine.createSpyObj('halService', { - getEndpoint: of(endpointURL), + getEndpoint: observableOf(endpointURL), }); rdbService = jasmine.createSpyObj('rdbService', { diff --git a/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.spec.ts b/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.spec.ts index fff3331e9cd..1019f892572 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.spec.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.spec.ts @@ -15,7 +15,7 @@ import { TranslateModule, TranslateService, } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { PaginatedList } from '../../../core/data/paginated-list.model'; import { RemoteData } from '../../../core/data/remote-data'; @@ -41,7 +41,7 @@ describe('LdnServicesOverviewComponent', () => { let modalService: NgbModal; const translateServiceStub = { - get: () => of('translated-text'), + get: () => observableOf('translated-text'), onLangChange: new EventEmitter(), onTranslationChange: new EventEmitter(), onDefaultLangChange: new EventEmitter(), @@ -96,7 +96,7 @@ describe('LdnServicesOverviewComponent', () => { modalService = TestBed.inject(NgbModal); component.modalRef = jasmine.createSpyObj({ close: null }); component.isProcessingSub = jasmine.createSpyObj({ unsubscribe: null }); - component.ldnServicesRD$ = of({} as RemoteData>); + component.ldnServicesRD$ = observableOf({} as RemoteData>); fixture.detectChanges(); }); @@ -162,7 +162,7 @@ describe('LdnServicesOverviewComponent', () => { const serviceId = '123'; const mockRemoteData = { /* just an empty object to retrieve as as RemoteData> */}; spyOn(component, 'setLdnServices').and.callThrough(); - const deleteSpy = ldnServicesService.delete.and.returnValue(of(mockRemoteData as RemoteData>)); + const deleteSpy = ldnServicesService.delete.and.returnValue(observableOf(mockRemoteData as RemoteData>)); component.selectedServiceId = serviceId; component.deleteSelected(serviceId, ldnServicesService); tick(); diff --git a/src/app/admin/admin-notify-dashboard/admin-notify-search-result/admin-notify-search-result.component.spec.ts b/src/app/admin/admin-notify-dashboard/admin-notify-search-result/admin-notify-search-result.component.spec.ts index 02f4f024e85..f65c6ddbcf3 100644 --- a/src/app/admin/admin-notify-dashboard/admin-notify-search-result/admin-notify-search-result.component.spec.ts +++ b/src/app/admin/admin-notify-dashboard/admin-notify-search-result/admin-notify-search-result.component.spec.ts @@ -7,10 +7,7 @@ import { import { RouterModule } from '@angular/router'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; -import { - of as observableOf, - of, -} from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service'; import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-configuration.service'; @@ -87,11 +84,11 @@ describe('AdminNotifySearchResultComponent', () => { beforeEach(async () => { adminNotifyMessageService = jasmine.createSpyObj('adminNotifyMessageService', { - getDetailedMessages: of(mockAdminNotifyMessages), - reprocessMessage: of(mockAdminNotifyMessages), + getDetailedMessages: observableOf(mockAdminNotifyMessages), + reprocessMessage: observableOf(mockAdminNotifyMessages), }); searchConfigService = jasmine.createSpyObj('searchConfigService', { - getCurrentConfiguration: of('NOTIFY.outgoing'), + getCurrentConfiguration: observableOf('NOTIFY.outgoing'), }); await TestBed.configureTestingModule({ @@ -150,7 +147,7 @@ describe('AdminNotifySearchResultComponent', () => { }); it('should unsubscribe on destroy', () => { - (component as any).subs = [of(null).subscribe()]; + (component as any).subs = [observableOf(null).subscribe()]; spyOn((component as any).subs[0], 'unsubscribe'); component.ngOnDestroy(); diff --git a/src/app/admin/admin-notify-dashboard/services/admin-notify-messages.service.spec.ts b/src/app/admin/admin-notify-dashboard/services/admin-notify-messages.service.spec.ts index 6178b201330..7edd33c22f3 100644 --- a/src/app/admin/admin-notify-dashboard/services/admin-notify-messages.service.spec.ts +++ b/src/app/admin/admin-notify-dashboard/services/admin-notify-messages.service.spec.ts @@ -2,7 +2,7 @@ import { deepClone } from 'fast-json-patch'; import { cold } from 'jasmine-marbles'; import { BehaviorSubject, - of, + of as observableOf, } from 'rxjs'; import { take } from 'rxjs/operators'; @@ -67,12 +67,12 @@ describe('AdminNotifyMessagesService test', () => { generateRequestId: requestUUID, send: true, removeByHrefSubstring: {}, - getByHref: of(responseCacheEntry), - getByUUID: of(responseCacheEntry), + getByHref: observableOf(responseCacheEntry), + getByUUID: observableOf(responseCacheEntry), }); halService = jasmine.createSpyObj('halService', { - getEndpoint: of(endpointURL), + getEndpoint: observableOf(endpointURL), }); rdbService = jasmine.createSpyObj('rdbService', { diff --git a/src/app/admin/admin-notify-dashboard/services/admin-notify-messages.service.ts b/src/app/admin/admin-notify-dashboard/services/admin-notify-messages.service.ts index 2211facfc87..496774241e4 100644 --- a/src/app/admin/admin-notify-dashboard/services/admin-notify-messages.service.ts +++ b/src/app/admin/admin-notify-dashboard/services/admin-notify-messages.service.ts @@ -3,7 +3,7 @@ import { BehaviorSubject, from, Observable, - of, + of as observableOf, scan, } from 'rxjs'; import { @@ -64,13 +64,13 @@ export class AdminNotifyMessagesService extends IdentifiableDataService ({ ...message, ldnService: detail.name })), - ) : of(message), + ) : observableOf(message), ), mergeMap(message => message.object || message.context ? this.itemDataService.findById(message.object || message.context).pipe( getAllSucceededRemoteDataPayload(), map(detail => ({ ...message, relatedItem: detail.name })), - ) : of(message), + ) : observableOf(message), ), scan((acc: any, value: any) => [...acc, value], []), ); diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workflow-item/workflow-item-admin-workflow-actions.component.spec.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workflow-item/workflow-item-admin-workflow-actions.component.spec.ts index f5240422833..b54dd11e020 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workflow-item/workflow-item-admin-workflow-actions.component.spec.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workflow-item/workflow-item-admin-workflow-actions.component.spec.ts @@ -7,7 +7,7 @@ import { import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { RemoteData } from '../../../../../core/data/remote-data'; import { RequestEntryState } from '../../../../../core/data/request-entry-state.model'; @@ -33,7 +33,7 @@ describe('WorkflowItemAdminWorkflowActionsComponent', () => { id = '780b2588-bda5-4112-a1cd-0b15000a5339'; wfi = new WorkflowItem(); wfi.id = id; - wfi.item = of(rd); + wfi.item = observableOf(rd); } beforeEach(waitForAsync(() => { diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.spec.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.spec.ts index ec0d446f1a7..043f991ca21 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.spec.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.spec.ts @@ -12,7 +12,7 @@ import { NgbPaginationModule, } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { Group } from '../../../../../../core/eperson/models/group.model'; import { SupervisionOrder } from '../../../../../../core/supervision-order/models/supervision-order.model'; @@ -29,7 +29,7 @@ describe('SupervisionOrderGroupSelectorComponent', () => { const modalStub = jasmine.createSpyObj('modalStub', ['close']); const supervisionOrderDataService: any = jasmine.createSpyObj('supervisionOrderDataService', { - create: of(new SupervisionOrder()), + create: observableOf(new SupervisionOrder()), }); const selectedOrderType = 'NONE'; diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/workspace-item-admin-workflow-actions.component.spec.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/workspace-item-admin-workflow-actions.component.spec.ts index b89c487ec06..685fb183f0d 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/workspace-item-admin-workflow-actions.component.spec.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/workspace-item-admin-workflow-actions.component.spec.ts @@ -8,7 +8,7 @@ import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service'; import { RemoteData } from '../../../../../core/data/remote-data'; @@ -46,7 +46,7 @@ describe('WorkspaceItemAdminWorkflowActionsComponent', () => { id = '780b2588-bda5-4112-a1cd-0b15000a5339'; wsi = new WorkspaceItem(); wsi.id = id; - wsi.item = of(rd); + wsi.item = observableOf(rd); } beforeEach(waitForAsync(() => { @@ -96,14 +96,14 @@ describe('WorkspaceItemAdminWorkflowActionsComponent', () => { beforeEach(() => { spyOn(component.delete, 'emit'); spyOn((component as any).modalService, 'open').and.returnValue({ - componentInstance: { response: of(true) }, + componentInstance: { response: observableOf(true) }, }); }); describe('when delete succeeded', () => { beforeEach(() => { - supervisionOrderDataService.delete.and.returnValue(of(true)); + supervisionOrderDataService.delete.and.returnValue(observableOf(true)); }); it('should notify success', () => { @@ -118,7 +118,7 @@ describe('WorkspaceItemAdminWorkflowActionsComponent', () => { describe('when delete failed', () => { beforeEach(() => { - supervisionOrderDataService.delete.and.returnValue(of(false)); + supervisionOrderDataService.delete.and.returnValue(observableOf(false)); }); it('should notify success', () => { @@ -137,7 +137,7 @@ describe('WorkspaceItemAdminWorkflowActionsComponent', () => { beforeEach(() => { spyOn(component.create, 'emit'); spyOn((component as any).modalService, 'open').and.returnValue({ - componentInstance: { create: of(true) }, + componentInstance: { create: observableOf(true) }, }); }); diff --git a/src/app/collection-page/edit-collection-page/collection-access-control/collection-access-control.component.spec.ts b/src/app/collection-page/edit-collection-page/collection-access-control/collection-access-control.component.spec.ts index a64a8a273d2..6e37c9bcaa1 100644 --- a/src/app/collection-page/edit-collection-page/collection-access-control/collection-access-control.component.spec.ts +++ b/src/app/collection-page/edit-collection-page/collection-access-control/collection-access-control.component.spec.ts @@ -3,10 +3,7 @@ import { TestBed, } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { - of as observableOf, - of, -} from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { Community } from '../../../core/shared/community.model'; import { AccessControlFormContainerComponent } from '../../../shared/access-control-form-container/access-control-form-container.component'; @@ -35,7 +32,7 @@ describe('CollectionAccessControlComponent', () => { const routeStub = { parent: { parent: { - data: of({ + data: observableOf({ dso: createSuccessfulRemoteDataObject(testCommunity), }), }, diff --git a/src/app/community-page/edit-community-page/community-access-control/community-access-control.component.spec.ts b/src/app/community-page/edit-community-page/community-access-control/community-access-control.component.spec.ts index 28879ed7abf..afd0e93bbe9 100644 --- a/src/app/community-page/edit-community-page/community-access-control/community-access-control.component.spec.ts +++ b/src/app/community-page/edit-community-page/community-access-control/community-access-control.component.spec.ts @@ -3,10 +3,7 @@ import { TestBed, } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { - of as observableOf, - of, -} from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { Community } from '../../../core/shared/community.model'; import { AccessControlFormContainerComponent } from '../../../shared/access-control-form-container/access-control-form-container.component'; @@ -36,7 +33,7 @@ describe('CommunityAccessControlComponent', () => { const routeStub = { parent: { parent: { - data: of({ + data: observableOf({ dso: createSuccessfulRemoteDataObject(testCommunity), }), }, diff --git a/src/app/core/breadcrumbs/publication-claim-breadcrumb.service.spec.ts b/src/app/core/breadcrumbs/publication-claim-breadcrumb.service.spec.ts index 8424b5edda8..0e947f88c34 100644 --- a/src/app/core/breadcrumbs/publication-claim-breadcrumb.service.spec.ts +++ b/src/app/core/breadcrumbs/publication-claim-breadcrumb.service.spec.ts @@ -3,7 +3,7 @@ import { waitForAsync, } from '@angular/core/testing'; import { getTestScheduler } from 'jasmine-marbles'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { Breadcrumb } from '../../breadcrumbs/breadcrumb/breadcrumb.model'; import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils'; @@ -23,7 +23,7 @@ describe('PublicationClaimBreadcrumbService', () => { }; let authorizationService: any = { - isAuthorized: (str) => of(true), + isAuthorized: (str) => observableOf(true), }; let exampleKey; diff --git a/src/app/core/coar-notify/notify-info/notify-info.guard.spec.ts b/src/app/core/coar-notify/notify-info/notify-info.guard.spec.ts index 706c8f684b9..d7ef634a99f 100644 --- a/src/app/core/coar-notify/notify-info/notify-info.guard.spec.ts +++ b/src/app/core/coar-notify/notify-info/notify-info.guard.spec.ts @@ -1,4 +1,4 @@ -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { notifyInfoGuard } from './notify-info.guard'; @@ -14,12 +14,12 @@ describe('notifyInfoGuard', () => { }); it('should be created', () => { - notifyInfoServiceSpy.isCoarConfigEnabled.and.returnValue(of(true)); + notifyInfoServiceSpy.isCoarConfigEnabled.and.returnValue(observableOf(true)); expect(guard(null, null, notifyInfoServiceSpy, router)).toBeTruthy(); }); it('should return true if COAR config is enabled', (done) => { - notifyInfoServiceSpy.isCoarConfigEnabled.and.returnValue(of(true)); + notifyInfoServiceSpy.isCoarConfigEnabled.and.returnValue(observableOf(true)); guard(null, null, notifyInfoServiceSpy, router).subscribe((result) => { expect(result).toBe(true); @@ -28,8 +28,8 @@ describe('notifyInfoGuard', () => { }); it('should call parseUrl method of Router if COAR config is not enabled', (done) => { - notifyInfoServiceSpy.isCoarConfigEnabled.and.returnValue(of(false)); - router.parseUrl.and.returnValue(of('/404')); + notifyInfoServiceSpy.isCoarConfigEnabled.and.returnValue(observableOf(false)); + router.parseUrl.and.returnValue(observableOf('/404')); guard(null, null, notifyInfoServiceSpy, router).subscribe(() => { expect(router.parseUrl).toHaveBeenCalledWith('/404'); diff --git a/src/app/core/coar-notify/notify-info/notify-info.service.spec.ts b/src/app/core/coar-notify/notify-info/notify-info.service.spec.ts index 6fa8295be06..7c6237c0cfc 100644 --- a/src/app/core/coar-notify/notify-info/notify-info.service.spec.ts +++ b/src/app/core/coar-notify/notify-info/notify-info.service.spec.ts @@ -1,6 +1,6 @@ import { TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils'; import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub'; @@ -14,10 +14,10 @@ describe('NotifyInfoService', () => { let authorizationDataService: any; beforeEach(() => { authorizationDataService = { - isAuthorized: jasmine.createSpy('isAuthorized').and.returnValue(of(true)), + isAuthorized: jasmine.createSpy('isAuthorized').and.returnValue(observableOf(true)), }; configurationDataService = { - findByPropertyName: jasmine.createSpy('findByPropertyName').and.returnValue(of({})), + findByPropertyName: jasmine.createSpy('findByPropertyName').and.returnValue(observableOf({})), }; TestBed.configureTestingModule({ providers: [ diff --git a/src/app/core/data/notify-services-status-data.service.spec.ts b/src/app/core/data/notify-services-status-data.service.spec.ts index e3368435052..474bee31658 100644 --- a/src/app/core/data/notify-services-status-data.service.spec.ts +++ b/src/app/core/data/notify-services-status-data.service.spec.ts @@ -2,7 +2,7 @@ import { cold, getTestScheduler, } from 'jasmine-marbles'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; import { NotifyRequestsStatus } from '../../item-page/simple/notify-requests-status/notify-requests-status.model'; @@ -57,12 +57,12 @@ describe('NotifyRequestsStatusDataService test', () => { generateRequestId: requestUUID, send: true, removeByHrefSubstring: {}, - getByHref: of(responseCacheEntry), - getByUUID: of(responseCacheEntry), + getByHref: observableOf(responseCacheEntry), + getByUUID: observableOf(responseCacheEntry), }); halService = jasmine.createSpyObj('halService', { - getEndpoint: of(endpointURL), + getEndpoint: observableOf(endpointURL), }); rdbService = jasmine.createSpyObj('rdbService', { diff --git a/src/app/core/data/processes/process-data.service.spec.ts b/src/app/core/data/processes/process-data.service.spec.ts index 217567776c2..8a41f7c37d9 100644 --- a/src/app/core/data/processes/process-data.service.spec.ts +++ b/src/app/core/data/processes/process-data.service.spec.ts @@ -13,7 +13,7 @@ import { waitForAsync, } from '@angular/core/testing'; import { ReducerManager } from '@ngrx/store'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; import { Process } from '../../../process-page/processes/process.model'; @@ -183,7 +183,7 @@ describe('ProcessDataService', () => { const runningProcessRD = new RemoteData(0, 0, 0, RequestEntryState.Success, null, runningProcessPagination); spyOn(processDataService, 'searchBy').and.returnValue( - of(runningProcessRD), + observableOf(runningProcessRD), ); expect(processDataService.searchBy).toHaveBeenCalledTimes(0); diff --git a/src/app/core/data/signposting-data.service.spec.ts b/src/app/core/data/signposting-data.service.spec.ts index 2b10bba89bb..162363dee55 100644 --- a/src/app/core/data/signposting-data.service.spec.ts +++ b/src/app/core/data/signposting-data.service.spec.ts @@ -3,7 +3,7 @@ import { TestBed, tick, } from '@angular/core/testing'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { APP_CONFIG } from '../../../config/app-config.interface'; import { DspaceRestService } from '../dspace-rest/dspace-rest.service'; @@ -64,7 +64,7 @@ describe('SignpostingDataService', () => { const uuid = '123'; const baseUrl = 'http://localhost:8080'; - restServiceSpy.get.and.returnValue(of(mockResponse)); + restServiceSpy.get.and.returnValue(observableOf(mockResponse)); let result: SignpostingLink[]; @@ -84,7 +84,7 @@ describe('SignpostingDataService', () => { const uuid = '123'; const baseUrl = 'http://localhost:8080'; - restServiceSpy.get.and.returnValue(of(mockErrResponse)); + restServiceSpy.get.and.returnValue(observableOf(mockErrResponse)); let result: any; diff --git a/src/app/core/data/version-history-data.service.spec.ts b/src/app/core/data/version-history-data.service.spec.ts index 607b938561b..b0911e383b3 100644 --- a/src/app/core/data/version-history-data.service.spec.ts +++ b/src/app/core/data/version-history-data.service.spec.ts @@ -2,7 +2,7 @@ import { fakeAsync, waitForAsync, } from '@angular/core/testing'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { getMockRequestService } from '../../shared/mocks/request.service.mock'; import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils'; @@ -179,7 +179,7 @@ describe('VersionHistoryDataService', () => { describe('isLatest$', () => { beforeEach(waitForAsync(() => { - spyOn(service, 'getLatestVersion$').and.returnValue(of(version2)); + spyOn(service, 'getLatestVersion$').and.returnValue(observableOf(version2)); })); it('should return false for version1', () => { service.isLatest$(version1).subscribe((res) => { diff --git a/src/app/core/google-recaptcha/google-recaptcha.service.ts b/src/app/core/google-recaptcha/google-recaptcha.service.ts index b4028f98358..6b3352a6837 100644 --- a/src/app/core/google-recaptcha/google-recaptcha.service.ts +++ b/src/app/core/google-recaptcha/google-recaptcha.service.ts @@ -10,7 +10,7 @@ import { combineLatest, EMPTY, Observable, - of, + of as observableOf, } from 'rxjs'; import { map, @@ -153,7 +153,7 @@ export class GoogleRecaptchaService { * Returns an observable of string */ public executeRecaptcha() { - return of(grecaptcha.execute()); + return observableOf(grecaptcha.execute()); } public getRecaptchaTokenResponse() { diff --git a/src/app/core/locale/locale.interceptor.spec.ts b/src/app/core/locale/locale.interceptor.spec.ts index 4725820a6b4..895a8286636 100644 --- a/src/app/core/locale/locale.interceptor.spec.ts +++ b/src/app/core/locale/locale.interceptor.spec.ts @@ -4,7 +4,7 @@ import { HttpTestingController, } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { RestRequestMethod } from '../data/rest-request-method'; import { DspaceRestService } from '../dspace-rest/dspace-rest.service'; @@ -20,7 +20,7 @@ describe(`LocaleInterceptor`, () => { const mockLocaleService = jasmine.createSpyObj('LocaleService', { getCurrentLanguageCode: jasmine.createSpy('getCurrentLanguageCode'), - getLanguageCodeList: of(languageList), + getLanguageCodeList: observableOf(languageList), }); beforeEach(() => { diff --git a/src/app/core/metadata/head-tag.service.spec.ts b/src/app/core/metadata/head-tag.service.spec.ts index 2fbae88f120..e94e671c043 100644 --- a/src/app/core/metadata/head-tag.service.spec.ts +++ b/src/app/core/metadata/head-tag.service.spec.ts @@ -15,7 +15,6 @@ import { TranslateService } from '@ngx-translate/core'; import { Observable, of as observableOf, - of, } from 'rxjs'; import { AppConfig } from '../../../config/app-config.interface'; @@ -90,7 +89,7 @@ describe('HeadTagService', () => { }); router = { url: '/items/0ec7ff22-f211-40ab-a69e-c819b0b1f357', - events: of(new NavigationEnd(1, '', '')), + events: observableOf(new NavigationEnd(1, '', '')), routerState: { root: {}, }, @@ -190,7 +189,7 @@ describe('HeadTagService', () => { })); it('route titles should overwrite dso titles', fakeAsync(() => { - (translateService.get as jasmine.Spy).and.returnValues(of('DSpace :: '), of('Translated Route Title')); + (translateService.get as jasmine.Spy).and.returnValues(observableOf('DSpace :: '), observableOf('Translated Route Title')); (headTagService as any).processRouteChange({ data: { value: { @@ -206,7 +205,7 @@ describe('HeadTagService', () => { })); it('other navigation should add title and description', fakeAsync(() => { - (translateService.get as jasmine.Spy).and.returnValues(of('DSpace :: '), of('Dummy Title'), of('This is a dummy item component for testing!')); + (translateService.get as jasmine.Spy).and.returnValues(observableOf('DSpace :: '), observableOf('Dummy Title'), observableOf('This is a dummy item component for testing!')); (headTagService as any).processRouteChange({ data: { value: { diff --git a/src/app/core/server-check/server-check.guard.spec.ts b/src/app/core/server-check/server-check.guard.spec.ts index e89b16eedcd..d3851c3e2a6 100644 --- a/src/app/core/server-check/server-check.guard.spec.ts +++ b/src/app/core/server-check/server-check.guard.spec.ts @@ -6,7 +6,7 @@ import { UrlTree, } from '@angular/router'; import { - of, + of as observableOf, ReplaySubject, } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; @@ -48,7 +48,7 @@ describe('ServerCheckGuard', () => { describe('when root endpoint request has succeeded', () => { beforeEach(() => { - rootDataServiceStub.checkServerAvailability.and.returnValue(of(true)); + rootDataServiceStub.checkServerAvailability.and.returnValue(observableOf(true)); }); it('should return true', () => { @@ -61,7 +61,7 @@ describe('ServerCheckGuard', () => { describe('when root endpoint request has not succeeded', () => { beforeEach(() => { - rootDataServiceStub.checkServerAvailability.and.returnValue(of(false)); + rootDataServiceStub.checkServerAvailability.and.returnValue(observableOf(false)); }); it('should return a UrlTree with the route to the 500 error page', () => { diff --git a/src/app/core/shared/math.service.spec.ts b/src/app/core/shared/math.service.spec.ts index 75d8bf1024c..45cf5843dff 100644 --- a/src/app/core/shared/math.service.spec.ts +++ b/src/app/core/shared/math.service.spec.ts @@ -1,7 +1,7 @@ import { TestBed } from '@angular/core/testing'; import { Observable, - of, + of as observableOf, } from 'rxjs'; import { @@ -19,7 +19,7 @@ export class MockMathService extends MathService { } ready(): Observable { - return of(true); + return observableOf(true); } render(element: HTMLElement): Promise { diff --git a/src/app/core/submission/workspaceitem-data.service.spec.ts b/src/app/core/submission/workspaceitem-data.service.spec.ts index 8837792a786..c8499f544a5 100644 --- a/src/app/core/submission/workspaceitem-data.service.spec.ts +++ b/src/app/core/submission/workspaceitem-data.service.spec.ts @@ -9,10 +9,7 @@ import { getTestScheduler, hot, } from 'jasmine-marbles'; -import { - of as observableOf, - of, -} from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { map } from 'rxjs/operators'; import { TestScheduler } from 'rxjs/testing'; @@ -160,7 +157,7 @@ describe('WorkspaceitemDataService test', () => { scheduler.schedule(() => service.findByItem('1234-1234', true, true, pageInfo)); scheduler.flush(); const searchUrl$ = - of('https://rest.api/rest/api/submission/workspaceitems/search/item') + observableOf('https://rest.api/rest/api/submission/workspaceitems/search/item') .pipe(map(href => service.buildHrefFromFindOptions(href, { searchParams: [new RequestParam('uuid', '1234-1234')] }, []))); searchUrl$.subscribe((url) => { expect(url).toEqual('https://rest.api/rest/api/submission/workspaceitems/search/item?uuid=1234-1234'); diff --git a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-field-values/dso-edit-metadata-field-values.component.spec.ts b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-field-values/dso-edit-metadata-field-values.component.spec.ts index 23859828c32..f68f002cdad 100644 --- a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-field-values/dso-edit-metadata-field-values.component.spec.ts +++ b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-field-values/dso-edit-metadata-field-values.component.spec.ts @@ -9,7 +9,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; import { BehaviorSubject, - of, + of as observableOf, } from 'rxjs'; import { DSpaceObject } from '../../../core/shared/dspace-object.model'; @@ -79,7 +79,7 @@ describe('DsoEditMetadataFieldValuesComponent', () => { component.dso = dso; component.form = form; component.mdField = mdField; - component.saving$ = of(false); + component.saving$ = observableOf(false); component.draggingMdField$ = draggingMdField$; fixture.detectChanges(); }); diff --git a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.spec.ts b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.spec.ts index e96959c1d1f..f65e6cb77e8 100644 --- a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.spec.ts +++ b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.spec.ts @@ -10,7 +10,7 @@ import { import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { MetadataField } from 'src/app/core/metadata/metadata-field.model'; import { MetadataSchema } from 'src/app/core/metadata/metadata-schema.model'; import { RegistryService } from 'src/app/core/registry/registry.service'; @@ -149,7 +149,7 @@ describe('DsoEditMetadataValueComponent', () => { ]; relationshipService = jasmine.createSpyObj('relationshipService', { - resolveMetadataRepresentation: of( + resolveMetadataRepresentation: observableOf( new ItemMetadataRepresentation(metadataValue), ), }); @@ -212,7 +212,7 @@ describe('DsoEditMetadataValueComponent', () => { component = fixture.componentInstance; component.mdValue = editMetadataValue; component.dso = dso; - component.saving$ = of(false); + component.saving$ = observableOf(false); fixture.detectChanges(); }); diff --git a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts index 234a8539c4b..ea189eafc05 100644 --- a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts +++ b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts @@ -25,7 +25,7 @@ import { BehaviorSubject, combineLatest as observableCombineLatest, Observable, - of, + of as observableOf, Subscription, } from 'rxjs'; import { @@ -188,7 +188,7 @@ export class DsoEditMetadataComponent implements OnInit, OnDestroy { const lazyProvider$: Observable> = lazyDataService(this.dataServiceMap, this.dsoType, this.parentInjector); return lazyProvider$; } else { - return of(this.updateDataService); + return observableOf(this.updateDataService); } } diff --git a/src/app/dso-shared/dso-edit-metadata/metadata-field-selector/metadata-field-selector.component.ts b/src/app/dso-shared/dso-edit-metadata/metadata-field-selector/metadata-field-selector.component.ts index 87dfe2200c7..cf99a3262c0 100644 --- a/src/app/dso-shared/dso-edit-metadata/metadata-field-selector/metadata-field-selector.component.ts +++ b/src/app/dso-shared/dso-edit-metadata/metadata-field-selector/metadata-field-selector.component.ts @@ -27,7 +27,7 @@ import { import { BehaviorSubject, Observable, - of, + of as observableOf, Subscription, } from 'rxjs'; import { @@ -187,7 +187,7 @@ export class MetadataFieldSelectorComponent implements OnInit, OnDestroy, AfterV getFirstCompletedRemoteData(), switchMap((rd) => { if (rd.hasSucceeded) { - return of(rd).pipe( + return observableOf(rd).pipe( metadataFieldsToString(), take(1), map((fields: string[]) => fields.indexOf(this.mdField) > -1), diff --git a/src/app/footer/footer.component.spec.ts b/src/app/footer/footer.component.spec.ts index 527e5703643..d98a4e12001 100644 --- a/src/app/footer/footer.component.spec.ts +++ b/src/app/footer/footer.component.spec.ts @@ -8,7 +8,7 @@ import { import { By } from '@angular/platform-browser'; import { ActivatedRoute } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { APP_CONFIG } from '../../config/app-config.interface'; import { environment } from '../../environments/environment.test'; @@ -22,7 +22,7 @@ let comp: FooterComponent; let fixture: ComponentFixture; let notifyInfoService = { - isCoarConfigEnabled: () => of(true), + isCoarConfigEnabled: () => observableOf(true), }; describe('Footer component', () => { @@ -83,7 +83,7 @@ describe('Footer component', () => { describe('when coarLdnEnabled is true', () => { beforeEach(() => { - spyOn(notifyInfoService, 'isCoarConfigEnabled').and.returnValue(of(true)); + spyOn(notifyInfoService, 'isCoarConfigEnabled').and.returnValue(observableOf(true)); fixture.detectChanges(); }); diff --git a/src/app/header/header.component.spec.ts b/src/app/header/header.component.spec.ts index 72fe87eac87..d18fc1a3335 100644 --- a/src/app/header/header.component.spec.ts +++ b/src/app/header/header.component.spec.ts @@ -9,10 +9,7 @@ import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { ActivatedRoute } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; -import { - of as observableOf, - of, -} from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { LocaleService } from '../core/locale/locale.service'; import { ThemedSearchNavbarComponent } from '../search-navbar/themed-search-navbar.component'; @@ -36,7 +33,7 @@ describe('HeaderComponent', () => { const languageList = ['en;q=1', 'it;q=0.9', 'de;q=0.8', 'fr;q=0.7']; const mockLocaleService = jasmine.createSpyObj('LocaleService', { getCurrentLanguageCode: jasmine.createSpy('getCurrentLanguageCode'), - getLanguageCodeList: of(languageList), + getLanguageCodeList: observableOf(languageList), }); diff --git a/src/app/health-page/health-page.component.spec.ts b/src/app/health-page/health-page.component.spec.ts index 7a62471c787..01fd31b5246 100644 --- a/src/app/health-page/health-page.component.spec.ts +++ b/src/app/health-page/health-page.component.spec.ts @@ -9,7 +9,7 @@ import { TranslateLoader, TranslateModule, } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { RawRestResponse } from '../core/dspace-rest/raw-rest-response.model'; import { @@ -29,13 +29,13 @@ describe('HealthPageComponent', () => { getInfo: jasmine.createSpy('getInfo'), }); - const healthRestResponse$ = of({ + const healthRestResponse$ = observableOf({ payload: HealthResponseObj, statusCode: 200, statusText: 'OK', } as RawRestResponse); - const healthInfoRestResponse$ = of({ + const healthInfoRestResponse$ = observableOf({ payload: HealthInfoResponseObj, statusCode: 200, statusText: 'OK', diff --git a/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts b/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts index 4329c923c4c..35426414adb 100644 --- a/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts +++ b/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts @@ -11,7 +11,7 @@ import { UntypedFormBuilder } from '@angular/forms'; import { By } from '@angular/platform-browser'; import { Router } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { AuthService } from '../../../core/auth/auth.service'; import { FeedbackDataService } from '../../../core/feedback/feedback-data.service'; @@ -34,11 +34,11 @@ describe('FeedbackFormComponent', () => { let de: DebugElement; const notificationService = new NotificationsServiceStub(); const feedbackDataServiceStub = jasmine.createSpyObj('feedbackDataService', { - create: of(new Feedback()), + create: observableOf(new Feedback()), }); const authService: AuthServiceStub = Object.assign(new AuthServiceStub(), { getAuthenticatedUserFromStore: () => { - return of(EPersonMock); + return observableOf(EPersonMock); }, }); const routerStub = new RouterMock(); diff --git a/src/app/info/notify-info/notify-info.component.spec.ts b/src/app/info/notify-info/notify-info.component.spec.ts index ecd584cfb0d..cc0b827d847 100644 --- a/src/app/info/notify-info/notify-info.component.spec.ts +++ b/src/app/info/notify-info/notify-info.component.spec.ts @@ -4,7 +4,7 @@ import { } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { NotifyInfoService } from '../../core/coar-notify/notify-info/notify-info.service'; import { ActivatedRouteStub } from '../../shared/testing/active-router.stub'; @@ -17,7 +17,7 @@ describe('NotifyInfoComponent', () => { beforeEach(async () => { notifyInfoServiceSpy = jasmine.createSpyObj('NotifyInfoService', { - getCoarLdnLocalInboxUrls: of([]), + getCoarLdnLocalInboxUrls: observableOf([]), }); await TestBed.configureTestingModule({ @@ -33,7 +33,7 @@ describe('NotifyInfoComponent', () => { beforeEach(() => { fixture = TestBed.createComponent(NotifyInfoComponent); component = fixture.componentInstance; - component.coarRestApiUrls$ = of(''); + component.coarRestApiUrls$ = observableOf(''); fixture.detectChanges(); }); diff --git a/src/app/item-page/alerts/item-alerts.component.spec.ts b/src/app/item-page/alerts/item-alerts.component.spec.ts index d2541f9d0d3..167407f7058 100644 --- a/src/app/item-page/alerts/item-alerts.component.spec.ts +++ b/src/app/item-page/alerts/item-alerts.component.spec.ts @@ -8,7 +8,7 @@ import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { ActivatedRoute } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service'; @@ -137,7 +137,7 @@ describe('ItemAlertsComponent', () => { beforeEach(() => { item = itemMock; component.item = item; - (correctionTypeDataService.findByItem).and.returnValue(of(correctionRD)); + (correctionTypeDataService.findByItem).and.returnValue(observableOf(correctionRD)); testScheduler = new TestScheduler((actual, expected) => { expect(actual).toEqual(expected); diff --git a/src/app/item-page/edit-item-page/item-access-control/item-access-control.component.spec.ts b/src/app/item-page/edit-item-page/item-access-control/item-access-control.component.spec.ts index fb7fff0e12b..c6c373f4dcf 100644 --- a/src/app/item-page/edit-item-page/item-access-control/item-access-control.component.spec.ts +++ b/src/app/item-page/edit-item-page/item-access-control/item-access-control.component.spec.ts @@ -3,7 +3,7 @@ import { TestBed, } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { AccessControlFormContainerComponent } from '../../../shared/access-control-form-container/access-control-form-container.component'; import { ItemAccessControlComponent } from './item-access-control.component'; @@ -18,7 +18,7 @@ describe('ItemAccessControlComponent', () => { pipe: () => { return { pipe: () => { - return of({}); + return observableOf({}); }, }; }, diff --git a/src/app/item-page/edit-item-page/item-status/item-status.component.ts b/src/app/item-page/edit-item-page/item-status/item-status.component.ts index 1bb17dc77c5..2a496fb9028 100644 --- a/src/app/item-page/edit-item-page/item-status/item-status.component.ts +++ b/src/app/item-page/edit-item-page/item-status/item-status.component.ts @@ -19,7 +19,7 @@ import { BehaviorSubject, combineLatest, Observable, - of, + of as observableOf, Subscription, } from 'rxjs'; import { @@ -227,7 +227,7 @@ export class ItemStatusComponent implements OnInit, OnDestroy { }), ); } else { - return of(false); + return observableOf(false); } }), // Switch map pushes the register DOI operation onto a copy of the base array then returns to the pipe @@ -255,7 +255,7 @@ export class ItemStatusComponent implements OnInit, OnDestroy { toArray(), ); - let orcidOps$ = of([]); + let orcidOps$ = observableOf([]); if (this.orcidAuthService.isLinkedToOrcid(item)) { orcidOps$ = this.orcidAuthService.onlyAdminCanDisconnectProfileFromOrcid().pipe( map((canDisconnect) => { diff --git a/src/app/item-page/mirador-viewer/mirador-viewer.component.ts b/src/app/item-page/mirador-viewer/mirador-viewer.component.ts index 5ad17569be5..d2fe0d7f247 100644 --- a/src/app/item-page/mirador-viewer/mirador-viewer.component.ts +++ b/src/app/item-page/mirador-viewer/mirador-viewer.component.ts @@ -18,7 +18,7 @@ import { import { TranslateModule } from '@ngx-translate/core'; import { Observable, - of, + of as observableOf, } from 'rxjs'; import { map, @@ -146,7 +146,7 @@ export class MiradorViewerComponent implements OnInit { // Set the multi property to 'true' if the item is searchable. if (this.searchable) { this.multi = true; - const observable = of(''); + const observable = observableOf(''); this.iframeViewerUrl = observable.pipe( map((val) => { return this.setURL(); diff --git a/src/app/item-page/orcid-page/orcid-auth/orcid-auth.component.spec.ts b/src/app/item-page/orcid-page/orcid-auth/orcid-auth.component.spec.ts index caaf3ff5bae..1da8d0f4484 100644 --- a/src/app/item-page/orcid-page/orcid-auth/orcid-auth.component.spec.ts +++ b/src/app/item-page/orcid-page/orcid-auth/orcid-auth.component.spec.ts @@ -17,7 +17,7 @@ import { TranslateModule, } from '@ngx-translate/core'; import { getTestScheduler } from 'jasmine-marbles'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; import { OrcidAuthService } from '../../../core/orcid/orcid-auth.service'; @@ -164,7 +164,7 @@ describe('OrcidAuthComponent test suite', () => { scheduler = getTestScheduler(); fixture = TestBed.createComponent(OrcidAuthComponent); comp = fixture.componentInstance; - orcidAuthService.getOrcidAuthorizationScopes.and.returnValue(of(orcidScopes)); + orcidAuthService.getOrcidAuthorizationScopes.and.returnValue(observableOf(orcidScopes)); })); describe('when orcid profile is not linked', () => { @@ -172,9 +172,9 @@ describe('OrcidAuthComponent test suite', () => { comp.item = mockItemUnlinkedToOrcid; orcidAuthService.getOrcidAuthorizationScopesByItem.and.returnValue([]); orcidAuthService.isLinkedToOrcid.and.returnValue(false); - orcidAuthService.onlyAdminCanDisconnectProfileFromOrcid.and.returnValue(of(false)); - orcidAuthService.ownerCanDisconnectProfileFromOrcid.and.returnValue(of(true)); - orcidAuthService.getOrcidAuthorizeUrl.and.returnValue(of('oarcidUrl')); + orcidAuthService.onlyAdminCanDisconnectProfileFromOrcid.and.returnValue(observableOf(false)); + orcidAuthService.ownerCanDisconnectProfileFromOrcid.and.returnValue(observableOf(true)); + orcidAuthService.getOrcidAuthorizeUrl.and.returnValue(observableOf('oarcidUrl')); fixture.detectChanges(); })); @@ -208,8 +208,8 @@ describe('OrcidAuthComponent test suite', () => { notificationsService = (comp as any).notificationsService; orcidAuthService.getOrcidAuthorizationScopesByItem.and.returnValue([...orcidScopes]); orcidAuthService.isLinkedToOrcid.and.returnValue(true); - orcidAuthService.onlyAdminCanDisconnectProfileFromOrcid.and.returnValue(of(false)); - orcidAuthService.ownerCanDisconnectProfileFromOrcid.and.returnValue(of(true)); + orcidAuthService.onlyAdminCanDisconnectProfileFromOrcid.and.returnValue(observableOf(false)); + orcidAuthService.ownerCanDisconnectProfileFromOrcid.and.returnValue(observableOf(true)); })); describe('and unlink is successfully', () => { @@ -251,8 +251,8 @@ describe('OrcidAuthComponent test suite', () => { comp.item = mockItemLinkedToOrcid; orcidAuthService.getOrcidAuthorizationScopesByItem.and.returnValue([...orcidScopes]); orcidAuthService.isLinkedToOrcid.and.returnValue(true); - orcidAuthService.onlyAdminCanDisconnectProfileFromOrcid.and.returnValue(of(false)); - orcidAuthService.ownerCanDisconnectProfileFromOrcid.and.returnValue(of(true)); + orcidAuthService.onlyAdminCanDisconnectProfileFromOrcid.and.returnValue(observableOf(false)); + orcidAuthService.ownerCanDisconnectProfileFromOrcid.and.returnValue(observableOf(true)); fixture.detectChanges(); })); @@ -280,8 +280,8 @@ describe('OrcidAuthComponent test suite', () => { comp.item = mockItemLinkedToOrcid; orcidAuthService.getOrcidAuthorizationScopesByItem.and.returnValue([...partialOrcidScopes]); orcidAuthService.isLinkedToOrcid.and.returnValue(true); - orcidAuthService.onlyAdminCanDisconnectProfileFromOrcid.and.returnValue(of(false)); - orcidAuthService.ownerCanDisconnectProfileFromOrcid.and.returnValue(of(true)); + orcidAuthService.onlyAdminCanDisconnectProfileFromOrcid.and.returnValue(observableOf(false)); + orcidAuthService.ownerCanDisconnectProfileFromOrcid.and.returnValue(observableOf(true)); fixture.detectChanges(); })); @@ -311,8 +311,8 @@ describe('OrcidAuthComponent test suite', () => { comp.item = mockItemLinkedToOrcid; orcidAuthService.getOrcidAuthorizationScopesByItem.and.returnValue([...orcidScopes]); orcidAuthService.isLinkedToOrcid.and.returnValue(true); - orcidAuthService.onlyAdminCanDisconnectProfileFromOrcid.and.returnValue(of(true)); - orcidAuthService.ownerCanDisconnectProfileFromOrcid.and.returnValue(of(false)); + orcidAuthService.onlyAdminCanDisconnectProfileFromOrcid.and.returnValue(observableOf(true)); + orcidAuthService.ownerCanDisconnectProfileFromOrcid.and.returnValue(observableOf(false)); fixture.detectChanges(); })); @@ -331,8 +331,8 @@ describe('OrcidAuthComponent test suite', () => { comp.item = mockItemLinkedToOrcid; orcidAuthService.getOrcidAuthorizationScopesByItem.and.returnValue([...orcidScopes]); orcidAuthService.isLinkedToOrcid.and.returnValue(true); - orcidAuthService.onlyAdminCanDisconnectProfileFromOrcid.and.returnValue(of(true)); - orcidAuthService.ownerCanDisconnectProfileFromOrcid.and.returnValue(of(true)); + orcidAuthService.onlyAdminCanDisconnectProfileFromOrcid.and.returnValue(observableOf(true)); + orcidAuthService.ownerCanDisconnectProfileFromOrcid.and.returnValue(observableOf(true)); fixture.detectChanges(); })); diff --git a/src/app/item-page/orcid-page/orcid-page.component.spec.ts b/src/app/item-page/orcid-page/orcid-page.component.spec.ts index fafb08ee3ef..d7568706226 100644 --- a/src/app/item-page/orcid-page/orcid-page.component.spec.ts +++ b/src/app/item-page/orcid-page/orcid-page.component.spec.ts @@ -17,10 +17,7 @@ import { TranslateModule, } from '@ngx-translate/core'; import { getTestScheduler } from 'jasmine-marbles'; -import { - of as observableOf, - of, -} from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; import { AuthService } from '../../core/auth/auth.service'; @@ -115,10 +112,10 @@ describe('OrcidPageComponent test suite', () => { orcidAuthService = jasmine.createSpyObj('OrcidAuthService', { isLinkedToOrcid: jasmine.createSpy('isLinkedToOrcid'), linkOrcidByItem: jasmine.createSpy('linkOrcidByItem'), - getOrcidAuthorizationScopes: of([]), - getOrcidAuthorizationScopesByItem: of([]), - onlyAdminCanDisconnectProfileFromOrcid: of(false), - ownerCanDisconnectProfileFromOrcid: of(false), + getOrcidAuthorizationScopes: observableOf([]), + getOrcidAuthorizationScopesByItem: observableOf([]), + onlyAdminCanDisconnectProfileFromOrcid: observableOf(false), + ownerCanDisconnectProfileFromOrcid: observableOf(false), }); researcherProfileDataService = jasmine.createSpyObj('ResearcherProfileDataService', { diff --git a/src/app/item-page/orcid-page/orcid-sync-settings/orcid-sync-settings.component.ts b/src/app/item-page/orcid-page/orcid-sync-settings/orcid-sync-settings.component.ts index 424baf45fbd..bc62bddb1e2 100644 --- a/src/app/item-page/orcid-page/orcid-sync-settings/orcid-sync-settings.component.ts +++ b/src/app/item-page/orcid-page/orcid-sync-settings/orcid-sync-settings.component.ts @@ -15,7 +15,7 @@ import { TranslateService, } from '@ngx-translate/core'; import { Operation } from 'fast-json-patch'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { switchMap } from 'rxjs/operators'; import { RemoteData } from '../../../core/data/remote-data'; @@ -174,7 +174,7 @@ export class OrcidSyncSettingsComponent implements OnInit { getFirstCompletedRemoteData(), ); } else { - return of(profileRD); + return observableOf(profileRD); } }), ).subscribe((remoteData: RemoteData) => { diff --git a/src/app/item-page/simple/item-page.component.ts b/src/app/item-page/simple/item-page.component.ts index fb2db4ad059..01a899e2f89 100644 --- a/src/app/item-page/simple/item-page.component.ts +++ b/src/app/item-page/simple/item-page.component.ts @@ -19,7 +19,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { combineLatest, Observable, - of, + of as observableOf, } from 'rxjs'; import { map, @@ -203,7 +203,7 @@ export class ItemPageComponent implements OnInit, OnDestroy { if (coarLdnEnabled) { return this.notifyInfoService.getCoarLdnLocalInboxUrls(); } else { - return of([]); + return observableOf([]); } }), ); 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 49c486b16b2..d09673eedba 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 @@ -19,7 +19,7 @@ import { } from '@ngx-translate/core'; import { Observable, - of, + of as observableOf, } from 'rxjs'; import { @@ -213,7 +213,7 @@ describe('PublicationComponent', () => { const localMockRouteService = { getPreviousUrl(): Observable { - return of('/search?query=test%20query&fakeParam=true'); + return observableOf('/search?query=test%20query&fakeParam=true'); }, }; beforeEach(waitForAsync(() => { @@ -243,7 +243,7 @@ describe('PublicationComponent', () => { describe('with IIIF viewer and search but no previous search query', () => { const localMockRouteService = { getPreviousUrl(): Observable { - return of('/item'); + return observableOf('/item'); }, }; beforeEach(waitForAsync(() => { 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 a03b76e24eb..a0ef8405d20 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 @@ -19,7 +19,7 @@ import { } from '@ngx-translate/core'; import { Observable, - of, + of as observableOf, } from 'rxjs'; import { APP_CONFIG } from '../../../../../config/app-config.interface'; @@ -229,7 +229,7 @@ describe('UntypedItemComponent', () => { describe('with IIIF viewer and search', () => { const localMockRouteService = { getPreviousUrl(): Observable { - return of('/search?query=test%20query&fakeParam=true'); + return observableOf('/search?query=test%20query&fakeParam=true'); }, }; beforeEach(waitForAsync(() => { @@ -260,7 +260,7 @@ describe('UntypedItemComponent', () => { const localMockRouteService = { getPreviousUrl(): Observable { - return of('/item'); + return observableOf('/item'); }, }; beforeEach(waitForAsync(() => { diff --git a/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.spec.ts b/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.spec.ts index 16141b0359b..b63e40d0ebd 100644 --- a/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.spec.ts +++ b/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.spec.ts @@ -7,7 +7,7 @@ import { By } from '@angular/platform-browser'; import { ActivatedRoute } from '@angular/router'; import { provideMockStore } from '@ngrx/store/testing'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { SplitPipe } from 'src/app/shared/utils/split.pipe'; import { APP_DATA_SERVICES_MAP } from '../../../../config/app-config.interface'; @@ -61,7 +61,7 @@ describe('QaEventNotificationComponent', () => { fixture = TestBed.createComponent(QaEventNotificationComponent); component = fixture.componentInstance; component.item = item; - component.sources$ = of([obj]); + component.sources$ = observableOf([obj]); fixture.detectChanges(); }); diff --git a/src/app/item-page/versions/item-versions-row-element-version/item-versions-row-element-version.component.spec.ts b/src/app/item-page/versions/item-versions-row-element-version/item-versions-row-element-version.component.spec.ts index 4a1e4488899..ba55722dda6 100644 --- a/src/app/item-page/versions/item-versions-row-element-version/item-versions-row-element-version.component.spec.ts +++ b/src/app/item-page/versions/item-versions-row-element-version/item-versions-row-element-version.component.spec.ts @@ -21,7 +21,6 @@ import { TranslateModule } from '@ngx-translate/core'; import { EMPTY, of as observableOf, - of, } from 'rxjs'; import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service'; @@ -82,8 +81,8 @@ describe('ItemVersionsRowElementVersionComponent', () => { const versionHistoryServiceSpy = jasmine.createSpyObj('versionHistoryService', { getVersions: createSuccessfulRemoteDataObject$(createPaginatedList([version])), - getVersionHistoryFromVersion$: of(versionHistory), - getLatestVersionItemFromHistory$: of(item), + getVersionHistoryFromVersion$: observableOf(versionHistory), + getLatestVersionItemFromHistory$: observableOf(item), }); const authorizationServiceSpy = jasmine.createSpyObj('authorizationService', { isAuthorized: observableOf(true), diff --git a/src/app/item-page/versions/item-versions-row-element-version/item-versions-row-element-version.component.ts b/src/app/item-page/versions/item-versions-row-element-version/item-versions-row-element-version.component.ts index 3d017c38a4a..7f9a074d31d 100644 --- a/src/app/item-page/versions/item-versions-row-element-version/item-versions-row-element-version.component.ts +++ b/src/app/item-page/versions/item-versions-row-element-version/item-versions-row-element-version.component.ts @@ -23,7 +23,7 @@ import { combineLatest, concatMap, Observable, - of, + of as observableOf, } from 'rxjs'; import { map, @@ -119,7 +119,7 @@ export class ItemVersionsRowElementVersionComponent implements OnInit { */ getWorkspaceId(versionItem: Observable>): Observable { if (!this.hasDraftVersion) { - return of(undefined); + return observableOf(undefined); } return versionItem.pipe( getFirstSucceededRemoteDataPayload(), @@ -138,7 +138,7 @@ export class ItemVersionsRowElementVersionComponent implements OnInit { return this.getWorkspaceId(versionItem).pipe( concatMap((workspaceId: string) => { if (workspaceId) { - return of(undefined); + return observableOf(undefined); } return versionItem.pipe( getFirstSucceededRemoteDataPayload(), @@ -191,7 +191,7 @@ export class ItemVersionsRowElementVersionComponent implements OnInit { // On createVersionEvent emitted create new version and notify activeModal.componentInstance.createVersionEvent.pipe( mergeMap((summary: string) => combineLatest([ - of(summary), + observableOf(summary), version.item.pipe(getFirstSucceededRemoteDataPayload()), ])), mergeMap(([summary, item]: [string, Item]) => this.versionHistoryService.createVersion(item._links.self.href, summary)), @@ -247,20 +247,20 @@ export class ItemVersionsRowElementVersionComponent implements OnInit { getFirstSucceededRemoteDataPayload(), // Retrieve version history mergeMap((item: Item) => combineLatest([ - of(item), + observableOf(item), this.versionHistoryService.getVersionHistoryFromVersion$(version), ])), // Delete item mergeMap(([item, versionHistory]: [Item, VersionHistory]) => combineLatest([ this.deleteItemAndGetResult$(item), - of(versionHistory), + observableOf(versionHistory), ])), // Retrieve new latest version mergeMap(([deleteItemResult, versionHistory]: [boolean, VersionHistory]) => combineLatest([ - of(deleteItemResult), + observableOf(deleteItemResult), this.versionHistoryService.getLatestVersionItemFromHistory$(versionHistory).pipe( tap(() => { - this.versionsHistoryChange.emit(of(versionHistory)); + this.versionsHistoryChange.emit(observableOf(versionHistory)); }), ), ])), diff --git a/src/app/item-page/versions/item-versions.component.spec.ts b/src/app/item-page/versions/item-versions.component.spec.ts index ee3c0110c80..d46174b5b8e 100644 --- a/src/app/item-page/versions/item-versions.component.spec.ts +++ b/src/app/item-page/versions/item-versions.component.spec.ts @@ -25,7 +25,6 @@ import { TranslateModule } from '@ngx-translate/core'; import { EMPTY, of as observableOf, - of, } from 'rxjs'; import { AuthService } from '../../core/auth/auth.service'; @@ -123,8 +122,8 @@ describe('ItemVersionsComponent', () => { const versionHistoryServiceSpy = jasmine.createSpyObj('versionHistoryService', { getVersions: createSuccessfulRemoteDataObject$(createPaginatedList(versions)), - getVersionHistoryFromVersion$: of(versionHistory), - getLatestVersionItemFromHistory$: of(item1), // called when version2 is deleted + getVersionHistoryFromVersion$: observableOf(versionHistory), + getLatestVersionItemFromHistory$: observableOf(item1), // called when version2 is deleted }); const authenticationServiceSpy = jasmine.createSpyObj('authenticationService', { isAuthenticated: observableOf(true), @@ -144,7 +143,7 @@ describe('ItemVersionsComponent', () => { }); const configurationServiceSpy = jasmine.createSpyObj('configurationService', { - findByPropertyName: of(true), + findByPropertyName: observableOf(true), }); const itemDataServiceSpy = jasmine.createSpyObj('itemDataService', { @@ -228,7 +227,7 @@ describe('ItemVersionsComponent', () => { describe('when the user can only delete a version', () => { beforeAll(waitForAsync(() => { - const canDelete = (featureID: FeatureID, url: string ) => of(featureID === FeatureID.CanDeleteVersion); + const canDelete = (featureID: FeatureID, url: string ) => observableOf(featureID === FeatureID.CanDeleteVersion); authorizationServiceSpy.isAuthorized.and.callFake(canDelete); })); it('should not disable the delete button', () => { diff --git a/src/app/item-page/versions/notice/item-versions-notice.component.spec.ts b/src/app/item-page/versions/notice/item-versions-notice.component.spec.ts index fd3c5096359..7e95713d472 100644 --- a/src/app/item-page/versions/notice/item-versions-notice.component.spec.ts +++ b/src/app/item-page/versions/notice/item-versions-notice.component.spec.ts @@ -8,7 +8,7 @@ import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { take } from 'rxjs/operators'; import { VersionHistoryDataService } from '../../../core/data/version-history-data.service'; @@ -79,10 +79,10 @@ describe('ItemVersionsNoticeComponent', () => { versionHistoryService = TestBed.inject(VersionHistoryDataService); - const isLatestFcn = (version: Version) => of((version.version === latestVersion.version)); + const isLatestFcn = (version: Version) => observableOf((version.version === latestVersion.version)); versionHistoryServiceSpy.getVersions.and.returnValue(createSuccessfulRemoteDataObject$(createPaginatedList(versions))); - versionHistoryServiceSpy.getLatestVersionFromHistory$.and.returnValue(of(latestVersion)); + versionHistoryServiceSpy.getLatestVersionFromHistory$.and.returnValue(observableOf(latestVersion)); versionHistoryServiceSpy.isLatest$.and.callFake(isLatestFcn); })); diff --git a/src/app/item-page/versions/notice/item-versions-notice.component.ts b/src/app/item-page/versions/notice/item-versions-notice.component.ts index c136d3f06f4..9f3376e040f 100644 --- a/src/app/item-page/versions/notice/item-versions-notice.component.ts +++ b/src/app/item-page/versions/notice/item-versions-notice.component.ts @@ -11,7 +11,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { EMPTY, Observable, - of, + of as observableOf, } from 'rxjs'; import { map, @@ -119,7 +119,7 @@ export class ItemVersionsNoticeComponent implements OnInit { map((isLatest) => isLatest != null && !isLatest), ); } else { - return of(false); + return observableOf(false); } }), startWith(false), diff --git a/src/app/my-dspace-page/my-dspace-qa-events-notifications/my-dspace-qa-events-notifications.component.ts b/src/app/my-dspace-page/my-dspace-qa-events-notifications/my-dspace-qa-events-notifications.component.ts index 9da65fb2e6e..bc6574791b7 100644 --- a/src/app/my-dspace-page/my-dspace-qa-events-notifications/my-dspace-qa-events-notifications.component.ts +++ b/src/app/my-dspace-page/my-dspace-qa-events-notifications/my-dspace-qa-events-notifications.component.ts @@ -12,7 +12,7 @@ import { RouterLink } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; import { Observable, - of, + of as observableOf, tap, } from 'rxjs'; import { QualityAssuranceSourceObject } from 'src/app/core/notifications/qa/models/quality-assurance-source.model'; @@ -44,7 +44,7 @@ export class MyDspaceQaEventsNotificationsComponent implements OnInit { /** * An Observable that emits an array of QualityAssuranceSourceObject. */ - sources$: Observable = of([]); + sources$: Observable = observableOf([]); constructor(private qualityAssuranceSourceDataService: QualityAssuranceSourceDataService) { } diff --git a/src/app/notifications/qa/events/quality-assurance-events.component.ts b/src/app/notifications/qa/events/quality-assurance-events.component.ts index df6d36d226a..a2f48de46ca 100644 --- a/src/app/notifications/qa/events/quality-assurance-events.component.ts +++ b/src/app/notifications/qa/events/quality-assurance-events.component.ts @@ -25,7 +25,7 @@ import { combineLatest, from, Observable, - of, + of as observableOf, Subscription, } from 'rxjs'; import { @@ -363,7 +363,7 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy { this.notificationsService.error( this.translateService.instant('quality-assurance.event.action.error'), ); - return of(this.eventsUpdated$.value); + return observableOf(this.eventsUpdated$.value); } }), ).subscribe((events: QualityAssuranceEventData[]) => { @@ -471,7 +471,7 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy { if (rd.payload?.page?.length > 0) { return this.fetchEvents(rd.payload.page); } else { - return of([]); + return observableOf([]); } } else { throw new Error('Can\'t retrieve Quality Assurance events from the Broker events REST service'); diff --git a/src/app/notifications/suggestion-targets/suggestion-targets.effects.ts b/src/app/notifications/suggestion-targets/suggestion-targets.effects.ts index de92e98ef86..8fd6092ed19 100644 --- a/src/app/notifications/suggestion-targets/suggestion-targets.effects.ts +++ b/src/app/notifications/suggestion-targets/suggestion-targets.effects.ts @@ -6,7 +6,7 @@ import { } from '@ngrx/effects'; import { Store } from '@ngrx/store'; import { TranslateService } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { catchError, map, @@ -55,7 +55,7 @@ export class SuggestionTargetsEffects { if (error instanceof Error) { console.error(error.message); } - return of(new RetrieveTargetsBySourceErrorAction(action.payload.source)); + return observableOf(new RetrieveTargetsBySourceErrorAction(action.payload.source)); }), ); }), @@ -98,7 +98,7 @@ export class SuggestionTargetsEffects { if (error instanceof Error) { console.error(error.message); } - return of(new RefreshUserSuggestionsErrorAction()); + return observableOf(new RefreshUserSuggestionsErrorAction()); }), ); }), @@ -106,7 +106,7 @@ export class SuggestionTargetsEffects { if (error instanceof Error) { console.error(error.message); } - return of(new RefreshUserSuggestionsErrorAction()); + return observableOf(new RefreshUserSuggestionsErrorAction()); }), ); })), diff --git a/src/app/notifications/suggestions-popup/suggestions-popup.component.ts b/src/app/notifications/suggestions-popup/suggestions-popup.component.ts index d2256c789db..a57b19aed39 100644 --- a/src/app/notifications/suggestions-popup/suggestions-popup.component.ts +++ b/src/app/notifications/suggestions-popup/suggestions-popup.component.ts @@ -14,7 +14,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { combineLatest, Observable, - of, + of as observableOf, Subject, Subscription, } from 'rxjs'; @@ -77,7 +77,7 @@ export class SuggestionsPopupComponent implements OnInit, OnDestroy { this.suggestionTargetsStateService.dispatchRefreshUserSuggestionsAction(); if (isNotEmpty(suggestions)) { if (!visited) { - this.suggestionsRD$ = of(suggestions); + this.suggestionsRD$ = observableOf(suggestions); this.suggestionTargetsStateService.dispatchMarkUserSuggestionsAsVisitedAction(); notifier.next(null); notifier.complete(); diff --git a/src/app/notifications/suggestions.service.ts b/src/app/notifications/suggestions.service.ts index f1790f830f5..354f39d8f6a 100644 --- a/src/app/notifications/suggestions.service.ts +++ b/src/app/notifications/suggestions.service.ts @@ -3,7 +3,7 @@ import { TranslateService } from '@ngx-translate/core'; import { forkJoin, Observable, - of, + of as observableOf, } from 'rxjs'; import { catchError, @@ -165,7 +165,7 @@ export class SuggestionsService { */ public retrieveCurrentUserSuggestions(userUuid: string): Observable { if (hasNoValue(userUuid)) { - return of([]); + return observableOf([]); } return this.researcherProfileService.findById(userUuid, true, true, followLink('item')).pipe( getFirstCompletedRemoteData(), @@ -179,10 +179,10 @@ export class SuggestionsService { }), ); } else { - return of([]); + return observableOf([]); } }), - catchError(() => of([])), + catchError(() => observableOf([])), ); } @@ -201,7 +201,7 @@ export class SuggestionsService { return workspaceitemService.importExternalSourceEntry(suggestion.externalSourceUri, resolvedCollectionId) .pipe( getFirstSucceededRemoteDataPayload(), - catchError(() => of(null)), + catchError(() => observableOf(null)), ); } @@ -211,7 +211,7 @@ export class SuggestionsService { */ public ignoreSuggestion(suggestionId): Observable> { return this.deleteReviewedSuggestion(suggestionId).pipe( - catchError(() => of(null)), + catchError(() => observableOf(null)), ); } diff --git a/src/app/profile-page/profile-claim-item-modal/profile-claim-item-modal.component.spec.ts b/src/app/profile-page/profile-claim-item-modal/profile-claim-item-modal.component.spec.ts index 9d515e1abba..e71f15ebe8b 100644 --- a/src/app/profile-page/profile-claim-item-modal/profile-claim-item-modal.component.spec.ts +++ b/src/app/profile-page/profile-claim-item-modal/profile-claim-item-modal.component.spec.ts @@ -11,7 +11,7 @@ import { } from '@angular/router'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { Item } from '../../core/shared/item.model'; import { getItemPageRoute } from '../../item-page/item-page-routing-paths'; @@ -135,7 +135,7 @@ describe('ProfileClaimItemModalComponent', () => { describe('when there are suggestions', () => { beforeEach(() => { - profileClaimService.searchForSuggestions.and.returnValue(of(searchResultRD)); + profileClaimService.searchForSuggestions.and.returnValue(observableOf(searchResultRD)); fixture.detectChanges(); }); @@ -184,7 +184,7 @@ describe('ProfileClaimItemModalComponent', () => { describe('when there are not suggestions', () => { beforeEach(() => { - profileClaimService.searchForSuggestions.and.returnValue(of(emptySearchResultRD)); + profileClaimService.searchForSuggestions.and.returnValue(observableOf(emptySearchResultRD)); fixture.detectChanges(); }); diff --git a/src/app/profile-page/profile-claim/profile-claim.service.ts b/src/app/profile-page/profile-claim/profile-claim.service.ts index dc04007dfa0..ee163ebe7e3 100644 --- a/src/app/profile-page/profile-claim/profile-claim.service.ts +++ b/src/app/profile-page/profile-claim/profile-claim.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable, - of, + of as observableOf, } from 'rxjs'; import { map } from 'rxjs/operators'; @@ -49,7 +49,7 @@ export class ProfileClaimService { searchForSuggestions(eperson: EPerson): Observable>> { const query = this.personQueryData(eperson); if (isEmpty(query)) { - return of(createNoContentRemoteDataObject() as RemoteData>); + return observableOf(createNoContentRemoteDataObject() as RemoteData>); } return this.lookup(query); } @@ -61,7 +61,7 @@ export class ProfileClaimService { */ private lookup(query: string): Observable>> { if (isEmpty(query)) { - return of(createNoContentRemoteDataObject() as RemoteData>); + return observableOf(createNoContentRemoteDataObject() as RemoteData>); } return this.searchService.search(new PaginatedSearchOptions({ configuration: 'eperson_claims', 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 68a4bfdfa6d..d6103c4d047 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 @@ -13,7 +13,7 @@ import { TranslateService, } from '@ngx-translate/core'; import cloneDeep from 'lodash/cloneDeep'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { ConfigurationDataService } from '../../core/data/configuration-data.service'; import { EPersonDataService } from '../../core/eperson/eperson-data.service'; @@ -75,7 +75,7 @@ describe('ProfilePageMetadataFormComponent', () => { }; configurationDataService = jasmine.createSpyObj('ConfigurationDataService', { - findByPropertyName: of({ payload: { value: 'test' } }), + findByPropertyName: observableOf({ payload: { value: 'test' } }), }); } 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 eda9110dc79..448d8d39e2c 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 @@ -16,10 +16,7 @@ import { By } from '@angular/platform-browser'; import { Router } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; -import { - of as observableOf, - of, -} from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { RestResponse } from '../core/cache/response.models'; import { ConfigurationDataService } from '../core/data/configuration-data.service'; @@ -53,8 +50,8 @@ describe('RegisterEmailFormComponent', () => { findByPropertyName: jasmine.createSpy('findByPropertyName'), }); - const captchaVersion$ = of('v3'); - const captchaMode$ = of('invisible'); + const captchaVersion$ = observableOf('v3'); + const captchaMode$ = observableOf('invisible'); const confResponse$ = createSuccessfulRemoteDataObject$({ values: ['true'] }); const confResponseDisabled$ = createSuccessfulRemoteDataObject$({ values: ['false'] }); diff --git a/src/app/register-email-form/register-email-form.component.ts b/src/app/register-email-form/register-email-form.component.ts index ac13abb865e..5d9c99da396 100644 --- a/src/app/register-email-form/register-email-form.component.ts +++ b/src/app/register-email-form/register-email-form.component.ts @@ -28,7 +28,7 @@ import { BehaviorSubject, combineLatest, Observable, - of, + of as observableOf, Subscription, switchMap, } from 'rxjs'; @@ -198,9 +198,9 @@ export class RegisterEmailFormComponent implements OnDestroy, OnInit { if (captchaVersion === 'v3') { return this.googleRecaptchaService.getRecaptchaToken('register_email'); } else if (captchaVersion === 'v2' && captchaMode === 'checkbox') { - return of(this.googleRecaptchaService.getRecaptchaTokenResponse()); + return observableOf(this.googleRecaptchaService.getRecaptchaTokenResponse()); } else if (captchaVersion === 'v2' && captchaMode === 'invisible') { - return of(tokenV2); + return observableOf(tokenV2); } else { console.error(`Invalid reCaptcha configuration: version = ${captchaVersion}, mode = ${captchaMode}`); this.showNotification('error'); @@ -258,7 +258,7 @@ export class RegisterEmailFormComponent implements OnDestroy, OnInit { const checked$ = this.checkboxCheckedSubject$.asObservable(); return combineLatest([this.captchaVersion(), this.captchaMode(), checked$]).pipe( // disable if checkbox is not checked or if reCaptcha is not in v2 checkbox mode - switchMap(([captchaVersion, captchaMode, checked]) => captchaVersion === 'v2' && captchaMode === 'checkbox' ? of(!checked) : of(false)), + switchMap(([captchaVersion, captchaMode, checked]) => captchaVersion === 'v2' && captchaMode === 'checkbox' ? observableOf(!checked) : observableOf(false)), startWith(true), ); } diff --git a/src/app/root/root.component.ts b/src/app/root/root.component.ts index b5c1c9be48e..963f964d141 100644 --- a/src/app/root/root.component.ts +++ b/src/app/root/root.component.ts @@ -18,7 +18,7 @@ import { BehaviorSubject, combineLatest as combineLatestObservable, Observable, - of, + of as observableOf, } from 'rxjs'; import { first, @@ -72,7 +72,7 @@ import { SystemWideAlertBannerComponent } from '../system-wide-alert/alert-banne ], }) export class RootComponent implements OnInit { - theme: Observable = of({} as any); + theme: Observable = observableOf({} as any); isSidebarVisible$: Observable; slideSidebarOver$: Observable; collapsedSidebarWidth$: Observable; 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 f3931a2016f..4412d1bb072 100644 --- a/src/app/search-page/configuration-search-page.component.spec.ts +++ b/src/app/search-page/configuration-search-page.component.spec.ts @@ -8,7 +8,7 @@ import { waitForAsync, } from '@angular/core/testing'; import { Router } from '@angular/router'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { RouteService } from '../core/services/route.service'; import { SearchConfigurationService } from '../core/shared/search/search-configuration.service'; @@ -53,7 +53,7 @@ describe('ConfigurationSearchPageComponent', () => { routeService = TestBed.inject(RouteService); routeService.setParameter = createSpy('setParameter'); - routeService.getRouteParameterValue = createSpy('getRouteParameterValue').and.returnValue(of(CONFIGURATION)); + routeService.getRouteParameterValue = createSpy('getRouteParameterValue').and.returnValue(observableOf(CONFIGURATION)); fixture.detectChanges(); diff --git a/src/app/shared/access-control-form-container/access-control-form-container.component.spec.ts b/src/app/shared/access-control-form-container/access-control-form-container.component.spec.ts index 69368b16c56..e1f3a4c1f09 100644 --- a/src/app/shared/access-control-form-container/access-control-form-container.component.spec.ts +++ b/src/app/shared/access-control-form-container/access-control-form-container.component.spec.ts @@ -13,7 +13,7 @@ import { } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; import { UiSwitchModule } from 'ngx-ui-switch'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { BulkAccessConfigDataService } from '../../core/config/bulk-access-config-data.service'; import { Item } from '../../core/shared/item.model'; @@ -43,21 +43,21 @@ describe('AccessControlFormContainerComponent', () => { // Mock dependencies const mockBulkAccessControlService = { createPayloadFile: jasmine.createSpy('createPayloadFile').and.returnValue({ file: 'mocked-file' }), - executeScript: jasmine.createSpy('executeScript').and.returnValue(of('success')), + executeScript: jasmine.createSpy('executeScript').and.returnValue(observableOf('success')), }; const mockBulkAccessConfigDataService = { - findByName: jasmine.createSpy('findByName').and.returnValue(of({ payload: { options: [] } })), + findByName: jasmine.createSpy('findByName').and.returnValue(observableOf({ payload: { options: [] } })), }; const mockSelectableListService = { - getSelectableList: jasmine.createSpy('getSelectableList').and.returnValue(of({ selection: [] })), + getSelectableList: jasmine.createSpy('getSelectableList').and.returnValue(observableOf({ selection: [] })), deselectAll: jasmine.createSpy('deselectAll'), }; const mockNgbModal = { open: jasmine.createSpy('open').and.returnValue( - { componentInstance: {}, closed: of({}) } as NgbModalRef, + { componentInstance: {}, closed: observableOf({}) } as NgbModalRef, ), }; 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 539de03b09b..a78aba4749e 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 @@ -17,7 +17,7 @@ import { StoreModule, } from '@ngrx/store'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { APP_DATA_SERVICES_MAP } from '../../../config/app-config.interface'; import { AppState } from '../../app.reducer'; @@ -53,7 +53,7 @@ describe('AuthNavMenuComponent', () => { function serviceInit() { authService = jasmine.createSpyObj('authService', { - getAuthenticatedUserFromStore: of(EPersonMock), + getAuthenticatedUserFromStore: observableOf(EPersonMock), setRedirectUrl: {}, }); } 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 c7ddf2ac34a..b262da4bf3d 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 @@ -19,7 +19,7 @@ import { TranslateModule, } from '@ngx-translate/core'; import { cold } from 'jasmine-marbles'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { APP_DATA_SERVICES_MAP } from '../../../../config/app-config.interface'; import { AppState } from '../../../app.reducer'; @@ -46,7 +46,7 @@ describe('UserMenuComponent', () => { function serviceInit() { authService = jasmine.createSpyObj('authService', { - getAuthenticatedUserFromStore: of(EPersonMock), + getAuthenticatedUserFromStore: observableOf(EPersonMock), }); } diff --git a/src/app/shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component.ts b/src/app/shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component.ts index cb2b5a9f0c5..173a28c4b73 100644 --- a/src/app/shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component.ts +++ b/src/app/shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component.ts @@ -7,7 +7,7 @@ import { TranslateService } from '@ngx-translate/core'; import { BehaviorSubject, Observable, - of, + of as observableOf, } from 'rxjs'; import { map, @@ -132,7 +132,7 @@ export class CreateComColPageComponent i ); } else { this.dsoDataService.refreshCache(dsoRD); - return of(true); + return observableOf(true); } } }), diff --git a/src/app/shared/dso-page/dso-versioning-modal-service/dso-versioning-modal.service.ts b/src/app/shared/dso-page/dso-versioning-modal-service/dso-versioning-modal.service.ts index e3a9a8c7927..8590e0e5f65 100644 --- a/src/app/shared/dso-page/dso-versioning-modal-service/dso-versioning-modal.service.ts +++ b/src/app/shared/dso-page/dso-versioning-modal-service/dso-versioning-modal.service.ts @@ -3,7 +3,7 @@ import { Router } from '@angular/router'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { Observable, - of, + of as observableOf, } from 'rxjs'; import { map, @@ -103,7 +103,7 @@ export class DsoVersioningModalService { */ getVersioningTooltipMessage(dso, tooltipMsgHasDraft, tooltipMsgCreate): Observable { return this.isNewVersionButtonDisabled(dso).pipe( - switchMap((hasDraftVersion) => of(hasDraftVersion ? tooltipMsgHasDraft : tooltipMsgCreate)), + switchMap((hasDraftVersion) => observableOf(hasDraftVersion ? tooltipMsgHasDraft : tooltipMsgCreate)), ); } } diff --git a/src/app/shared/dso-selector/modal-wrappers/import-batch-selector/import-batch-selector.component.ts b/src/app/shared/dso-selector/modal-wrappers/import-batch-selector/import-batch-selector.component.ts index 2b3785c0f9c..985581f0b6c 100644 --- a/src/app/shared/dso-selector/modal-wrappers/import-batch-selector/import-batch-selector.component.ts +++ b/src/app/shared/dso-selector/modal-wrappers/import-batch-selector/import-batch-selector.component.ts @@ -10,7 +10,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; import { Observable, - of, + of as observableOf, } from 'rxjs'; import { Collection } from '../../../../core/shared/collection.model'; @@ -53,9 +53,9 @@ export class ImportBatchSelectorComponent extends DSOSelectorModalWrapperCompone navigate(dso: DSpaceObject): Observable { if (dso instanceof Collection) { this.response.emit(dso); - return of(null); + return observableOf(null); } this.response.emit(null); - return of(null); + return observableOf(null); } } 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 2dce8302ce8..18de23727f4 100644 --- a/src/app/shared/lang-switch/lang-switch.component.spec.ts +++ b/src/app/shared/lang-switch/lang-switch.component.spec.ts @@ -19,7 +19,7 @@ import { } from '@ngx-translate/core'; import { Observable, - of, + of as observableOf, } from 'rxjs'; import { LangConfig } from '../../../config/lang-config.interface'; @@ -35,7 +35,7 @@ import { LangSwitchComponent } from './lang-switch.component'; /* eslint-disable quote-props */ class CustomLoader implements TranslateLoader { getTranslation(lang: string): Observable { - return of({ + return observableOf({ 'footer': { 'copyright': 'copyright © 2002-{{ year }}', 'link.dspace': 'DSpace software', diff --git a/src/app/shared/live-region/live-region.component.spec.ts b/src/app/shared/live-region/live-region.component.spec.ts index 86cf24f49b2..66b354ef7a7 100644 --- a/src/app/shared/live-region/live-region.component.spec.ts +++ b/src/app/shared/live-region/live-region.component.spec.ts @@ -5,7 +5,7 @@ import { } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { LiveRegionComponent } from './live-region.component'; import { LiveRegionService } from './live-region.service'; @@ -16,7 +16,7 @@ describe('liveRegionComponent', () => { beforeEach(waitForAsync(() => { liveRegionService = jasmine.createSpyObj('liveRegionService', { - getMessages$: of(['message1', 'message2']), + getMessages$: observableOf(['message1', 'message2']), getLiveRegionVisibility: false, setLiveRegionVisibility: undefined, }); 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 571f8b26258..4696838a8e7 100644 --- a/src/app/shared/log-in/log-in.component.spec.ts +++ b/src/app/shared/log-in/log-in.component.spec.ts @@ -18,7 +18,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { StoreModule } from '@ngrx/store'; import { provideMockStore } from '@ngrx/store/testing'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { authReducer } from '../../core/auth/auth.reducer'; import { AuthService } from '../../core/auth/auth.service'; @@ -60,7 +60,7 @@ describe('LogInComponent', () => { getCurrentRoute: {}, }); authorizationService = jasmine.createSpyObj('authorizationService', { - isAuthorized: of(true), + isAuthorized: observableOf(true), }); // refine the test module by declaring the test component diff --git a/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.ts b/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.ts index 6de3df6e093..273c39ad5bc 100644 --- a/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.ts +++ b/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.ts @@ -14,7 +14,7 @@ import { } from '@ngx-translate/core'; import { Observable, - of, + of as observableOf, } from 'rxjs'; import { RemoteData } from '../../../../core/data/remote-data'; @@ -53,7 +53,7 @@ export class ClaimedTaskActionsApproveComponent extends ClaimedTaskActionsAbstra } reloadObjectExecution(): Observable | DSpaceObject> { - return of(this.object); + return observableOf(this.object); } convertReloadedObject(dso: DSpaceObject): DSpaceObject { 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 fb1f42879f6..a72e8d13b60 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 @@ -23,7 +23,7 @@ import { TranslateLoader, TranslateModule, } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { RequestService } from '../../../../core/data/request.service'; import { SearchService } from '../../../../core/shared/search/search.service'; @@ -52,7 +52,7 @@ const requestService = getMockRequestService(); const object = Object.assign(new ClaimedTask(), { id: 'claimed-task-1' }); const claimedTaskService = jasmine.createSpyObj('claimedTaskService', { - submitTask: of(new ProcessTaskResponse(true)), + submitTask: observableOf(new ProcessTaskResponse(true)), }); let mockPoolTaskDataService: PoolTaskDataService; @@ -135,7 +135,7 @@ describe('ClaimedTaskActionsRejectComponent', () => { beforeEach(() => { spyOn(component.processCompleted, 'emit'); - spyOn(component, 'startActionExecution').and.returnValue(of(null)); + spyOn(component, 'startActionExecution').and.returnValue(observableOf(null)); expectedBody = { [component.option]: 'true', diff --git a/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.ts b/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.ts index 9a8c98c66e9..311e1a79636 100644 --- a/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.ts +++ b/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.ts @@ -26,7 +26,7 @@ import { } from '@ngx-translate/core'; import { Observable, - of, + of as observableOf, } from 'rxjs'; import { RemoteData } from '../../../../core/data/remote-data'; @@ -109,7 +109,7 @@ export class ClaimedTaskActionsRejectComponent extends ClaimedTaskActionsAbstrac } reloadObjectExecution(): Observable | DSpaceObject> { - return of(this.object); + return observableOf(this.object); } convertReloadedObject(dso: DSpaceObject): DSpaceObject { 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 915e1ad4f5a..0637eed96c8 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 @@ -15,7 +15,7 @@ import { TranslateLoader, TranslateModule, } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { RequestService } from '../../../../core/data/request.service'; import { SearchService } from '../../../../core/shared/search/search.service'; @@ -43,7 +43,7 @@ let mockPoolTaskDataService: PoolTaskDataService; describe('ClaimedTaskActionsReturnToPoolComponent', () => { const object = Object.assign(new ClaimedTask(), { id: 'claimed-task-1' }); const claimedTaskService = jasmine.createSpyObj('claimedTaskService', { - returnToPoolTask: of(new ProcessTaskResponse(true)), + returnToPoolTask: observableOf(new ProcessTaskResponse(true)), }); beforeEach(waitForAsync(() => { @@ -110,7 +110,7 @@ describe('ClaimedTaskActionsReturnToPoolComponent', () => { describe('reloadObjectExecution', () => { beforeEach(() => { - spyOn(mockPoolTaskDataService, 'findByItem').and.returnValue(of(null)); + spyOn(mockPoolTaskDataService, 'findByItem').and.returnValue(observableOf(null)); component.itemUuid = 'uuid'; component.reloadObjectExecution().subscribe(); diff --git a/src/app/shared/mydspace-actions/mydspace-reloadable-actions.ts b/src/app/shared/mydspace-actions/mydspace-reloadable-actions.ts index 28e3ac4040c..497eaa3be5a 100644 --- a/src/app/shared/mydspace-actions/mydspace-reloadable-actions.ts +++ b/src/app/shared/mydspace-actions/mydspace-reloadable-actions.ts @@ -7,7 +7,7 @@ import { Router } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; import { Observable, - of, + of as observableOf, } from 'rxjs'; import { map, @@ -88,7 +88,7 @@ export abstract class MyDSpaceReloadableActionsComponent { if (res instanceof RemoteData) { - return of(res).pipe(getFirstCompletedRemoteData(), map((completed) => completed.payload)); + return observableOf(res).pipe(getFirstCompletedRemoteData(), map((completed) => completed.payload)); } else { - return of(res); + return observableOf(res); } })).pipe(map((dso) => { return dso ? this.convertReloadedObject(dso) : dso; diff --git a/src/app/shared/object-collection/shared/badges/themed-badges.component.ts b/src/app/shared/object-collection/shared/badges/themed-badges.component.ts index dbc9b453072..260c32d2b47 100644 --- a/src/app/shared/object-collection/shared/badges/themed-badges.component.ts +++ b/src/app/shared/object-collection/shared/badges/themed-badges.component.ts @@ -21,7 +21,7 @@ import { BadgesComponent } from './badges.component'; export class ThemedBadgesComponent extends ThemedComponent { @Input() object: DSpaceObject; @Input() context: Context; - @Input() showAccessStatus = false; + @Input() showAccessStatus: boolean; protected inAndOutputNames: (keyof BadgesComponent & keyof this)[] = ['object', 'context', 'showAccessStatus']; 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 86d4b5c8d43..0c0cd90917e 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 @@ -7,7 +7,7 @@ import { import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { ConfigurationDataService } from '../../../core/data/configuration-data.service'; import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service'; @@ -38,7 +38,7 @@ describe('ItemSelectComponent', () => { const mockItemList = [ Object.assign(new Item(), { id: 'id1', - bundles: of({}), + bundles: observableOf({}), metadata: [ { key: 'dc.title', @@ -54,7 +54,7 @@ describe('ItemSelectComponent', () => { }), Object.assign(new Item(), { id: 'id2', - bundles: of({}), + bundles: observableOf({}), metadata: [ { key: 'dc.title', @@ -186,7 +186,7 @@ describe('ItemSelectComponent', () => { beforeEach(() => { comp.featureId = FeatureID.CanManageMappings; - spyOn(authorizationDataService, 'isAuthorized').and.returnValue(of(false)); + spyOn(authorizationDataService, 'isAuthorized').and.returnValue(observableOf(false)); comp.ngOnInit(); }); diff --git a/src/app/shared/object-select/object-select.service.spec.ts b/src/app/shared/object-select/object-select.service.spec.ts index ace1bcdd232..e3953220487 100644 --- a/src/app/shared/object-select/object-select.service.spec.ts +++ b/src/app/shared/object-select/object-select.service.spec.ts @@ -1,5 +1,5 @@ import { Store } from '@ngrx/store'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { AppState } from '../../app.reducer'; import { @@ -26,21 +26,21 @@ describe('ObjectSelectService', () => { /* eslint-disable no-empty,@typescript-eslint/no-empty-function */ dispatch: {}, /* eslint-enable no-empty,@typescript-eslint/no-empty-function */ - select: of(true), + select: observableOf(true), }); const store: Store = jasmine.createSpyObj('store', { /* eslint-disable no-empty,@typescript-eslint/no-empty-function */ dispatch: {}, /* eslint-enable no-empty,@typescript-eslint/no-empty-function */ - select: of(true), + select: observableOf(true), }); const appStore: Store = jasmine.createSpyObj('appStore', { /* eslint-disable no-empty,@typescript-eslint/no-empty-function */ dispatch: {}, /* eslint-enable no-empty, @typescript-eslint/no-empty-function */ - select: of(true), + select: observableOf(true), }); beforeEach(() => { diff --git a/src/app/shared/object-select/object-select/object-select.component.ts b/src/app/shared/object-select/object-select/object-select.component.ts index 323a7cc3969..2fc84aeedf5 100644 --- a/src/app/shared/object-select/object-select/object-select.component.ts +++ b/src/app/shared/object-select/object-select/object-select.component.ts @@ -8,7 +8,7 @@ import { } from '@angular/core'; import { Observable, - of, + of as observableOf, } from 'rxjs'; import { startWith, @@ -140,7 +140,7 @@ export abstract class ObjectSelectComponent implem */ canSelect(item: DSpaceObject): Observable { if (!this.featureId) { - return of(true); + return observableOf(true); } return this.authorizationService.isAuthorized(this.featureId, item.self).pipe(startWith(false)); } diff --git a/src/app/shared/resource-policies/edit/resource-policy-edit.component.ts b/src/app/shared/resource-policies/edit/resource-policy-edit.component.ts index 43e7b550fe3..f37c4d51994 100644 --- a/src/app/shared/resource-policies/edit/resource-policy-edit.component.ts +++ b/src/app/shared/resource-policies/edit/resource-policy-edit.component.ts @@ -14,7 +14,7 @@ import { BehaviorSubject, combineLatest as observableCombineLatest, Observable, - of, + of as observableOf, } from 'rxjs'; import { map, @@ -118,7 +118,7 @@ export class ResourcePolicyEditComponent implements OnInit { ).pipe( getFirstCompletedRemoteData(), map((responseRD) => responseRD && responseRD.hasSucceeded), - ) : of(true); + ) : observableOf(true); const updateResourcePolicySucceeded$ = this.resourcePolicyService.update(updatedObject).pipe( getFirstCompletedRemoteData(), diff --git a/src/app/shared/results-back-button/results-back-button.component.spec.ts b/src/app/shared/results-back-button/results-back-button.component.spec.ts index 12e5e255fd3..1b0884f9e29 100644 --- a/src/app/shared/results-back-button/results-back-button.component.spec.ts +++ b/src/app/shared/results-back-button/results-back-button.component.spec.ts @@ -9,7 +9,7 @@ import { TranslateModule, TranslateService, } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { ResultsBackButtonComponent } from './results-back-button.component'; @@ -19,7 +19,7 @@ describe('ResultsBackButtonComponent', () => { let fixture: ComponentFixture; const translate = { - get: jasmine.createSpy('get').and.returnValue(of('item button')), + get: jasmine.createSpy('get').and.returnValue(observableOf('item button')), }; describe('back to results', () => { @@ -42,7 +42,7 @@ describe('ResultsBackButtonComponent', () => { translate.get.calls.reset(); fixture = TestBed.createComponent(ResultsBackButtonComponent); component = fixture.componentInstance; - component.buttonLabel = of('browse button'); + component.buttonLabel = observableOf('browse button'); component.ngOnInit(); fixture.detectChanges(); })); diff --git a/src/app/shared/testing/object-select-service.stub.ts b/src/app/shared/testing/object-select-service.stub.ts index 05f5a509c0e..37859c83c30 100644 --- a/src/app/shared/testing/object-select-service.stub.ts +++ b/src/app/shared/testing/object-select-service.stub.ts @@ -1,6 +1,6 @@ import { Observable, - of, + of as observableOf, } from 'rxjs'; export class ObjectSelectServiceStub { @@ -15,14 +15,14 @@ export class ObjectSelectServiceStub { getSelected(id: string): Observable { if (this.ids.indexOf(id) > -1) { - return of(true); + return observableOf(true); } else { - return of(false); + return observableOf(false); } } getAllSelected(): Observable { - return of(this.ids); + return observableOf(this.ids); } switch(id: string) { diff --git a/src/app/shared/testing/test-data-service.mock.ts b/src/app/shared/testing/test-data-service.mock.ts index b5529f4a070..5c878fd7703 100644 --- a/src/app/shared/testing/test-data-service.mock.ts +++ b/src/app/shared/testing/test-data-service.mock.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { Operation } from 'fast-json-patch'; import { Observable, - of, + of as observableOf, } from 'rxjs'; import { FindListOptions } from '../../core/data/find-list-options.model'; @@ -14,11 +14,11 @@ import { FollowLinkConfig } from '../utils/follow-link-config.model'; @Injectable() export class TestDataService { findListByHref(href: string, findListOptions: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig[]) { - return of('findListByHref'); + return observableOf('findListByHref'); } findByHref(href: string, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig[]) { - return of('findByHref'); + return observableOf('findByHref'); } patch(object: Item, operations: Operation[]): Observable> { diff --git a/src/app/statistics-page/statistics-table/statistics-table.component.ts b/src/app/statistics-page/statistics-table/statistics-table.component.ts index cd717305681..a161c400c3f 100644 --- a/src/app/statistics-page/statistics-table/statistics-table.component.ts +++ b/src/app/statistics-page/statistics-table/statistics-table.component.ts @@ -14,7 +14,7 @@ import { } from '@ngx-translate/core'; import { Observable, - of, + of as observableOf, } from 'rxjs'; import { map } from 'rxjs/operators'; @@ -88,7 +88,7 @@ export class StatisticsTableComponent implements OnInit { case 'TopCities': case 'topCountries': default: - return of(point.label); + return observableOf(point.label); } } } diff --git a/src/app/statistics/google-analytics.service.spec.ts b/src/app/statistics/google-analytics.service.spec.ts index eb35750c4ca..e168236f827 100644 --- a/src/app/statistics/google-analytics.service.spec.ts +++ b/src/app/statistics/google-analytics.service.spec.ts @@ -2,7 +2,7 @@ import { Angulartics2GoogleAnalytics, Angulartics2GoogleGlobalSiteTag, } from 'angulartics2'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { ConfigurationDataService } from '../core/data/configuration-data.service'; import { ConfigurationProperty } from '../core/shared/configuration-property.model'; @@ -73,7 +73,7 @@ describe('GoogleAnalyticsService', () => { body: bodyElementSpy, }); - klaroServiceSpy.getSavedPreferences.and.returnValue(of({ + klaroServiceSpy.getSavedPreferences.and.returnValue(observableOf({ GOOGLE_ANALYTICS_KLARO_KEY: true, })); @@ -97,7 +97,7 @@ describe('GoogleAnalyticsService', () => { findByPropertyName: createFailedRemoteDataObject$(), }); - klaroServiceSpy.getSavedPreferences.and.returnValue(of({ + klaroServiceSpy.getSavedPreferences.and.returnValue(observableOf({ GOOGLE_ANALYTICS_KLARO_KEY: true, })); @@ -120,7 +120,7 @@ describe('GoogleAnalyticsService', () => { describe('when the tracking id is empty', () => { beforeEach(() => { configSpy = createConfigSuccessSpy(); - klaroServiceSpy.getSavedPreferences.and.returnValue(of({ + klaroServiceSpy.getSavedPreferences.and.returnValue(observableOf({ [GOOGLE_ANALYTICS_KLARO_KEY]: true, })); service = new GoogleAnalyticsService(googleAnalyticsSpy, googleTagManagerSpy, klaroServiceSpy, configSpy, documentSpy); @@ -141,7 +141,7 @@ describe('GoogleAnalyticsService', () => { describe('when google-analytics cookie preferences are not existing', () => { beforeEach(() => { configSpy = createConfigSuccessSpy(trackingIdV4TestValue); - klaroServiceSpy.getSavedPreferences.and.returnValue(of({})); + klaroServiceSpy.getSavedPreferences.and.returnValue(observableOf({})); service = new GoogleAnalyticsService(googleAnalyticsSpy, googleTagManagerSpy, klaroServiceSpy, configSpy, documentSpy); }); @@ -161,7 +161,7 @@ describe('GoogleAnalyticsService', () => { describe('when google-analytics cookie preferences are set to false', () => { beforeEach(() => { configSpy = createConfigSuccessSpy(trackingIdV4TestValue); - klaroServiceSpy.getSavedPreferences.and.returnValue(of({ + klaroServiceSpy.getSavedPreferences.and.returnValue(observableOf({ [GOOGLE_ANALYTICS_KLARO_KEY]: false, })); service = new GoogleAnalyticsService(googleAnalyticsSpy, googleTagManagerSpy, klaroServiceSpy, configSpy, documentSpy); @@ -183,7 +183,7 @@ describe('GoogleAnalyticsService', () => { beforeEach(() => { configSpy = createConfigSuccessSpy(trackingIdV4TestValue); - klaroServiceSpy.getSavedPreferences.and.returnValue(of({ + klaroServiceSpy.getSavedPreferences.and.returnValue(observableOf({ [GOOGLE_ANALYTICS_KLARO_KEY]: true, })); service = new GoogleAnalyticsService(googleAnalyticsSpy, googleTagManagerSpy, klaroServiceSpy, configSpy, documentSpy); @@ -220,7 +220,7 @@ describe('GoogleAnalyticsService', () => { beforeEach(() => { configSpy = createConfigSuccessSpy(trackingIdV3TestValue); - klaroServiceSpy.getSavedPreferences.and.returnValue(of({ + klaroServiceSpy.getSavedPreferences.and.returnValue(observableOf({ [GOOGLE_ANALYTICS_KLARO_KEY]: true, })); service = new GoogleAnalyticsService(googleAnalyticsSpy, googleTagManagerSpy, klaroServiceSpy, configSpy, documentSpy); diff --git a/src/app/submission/edit/submission-edit.component.spec.ts b/src/app/submission/edit/submission-edit.component.spec.ts index 59f9883f19b..4f5df2796fc 100644 --- a/src/app/submission/edit/submission-edit.component.spec.ts +++ b/src/app/submission/edit/submission-edit.component.spec.ts @@ -12,10 +12,7 @@ import { import { RouterTestingModule } from '@angular/router/testing'; import { provideMockStore } from '@ngrx/store/testing'; import { TranslateModule } from '@ngx-translate/core'; -import { - of as observableOf, - of, -} from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { APP_DATA_SERVICES_MAP } from '../../../config/app-config.interface'; import { AuthService } from '../../core/auth/auth.service'; @@ -62,7 +59,7 @@ describe('SubmissionEditComponent Component', () => { }); halService = jasmine.createSpyObj('halService', { - getEndpoint: of('fake-url'), + getEndpoint: observableOf('fake-url'), }); TestBed.configureTestingModule({ diff --git a/src/app/submission/form/collection/submission-form-collection.component.spec.ts b/src/app/submission/form/collection/submission-form-collection.component.spec.ts index 540c2ba561a..ad74ca2fa8f 100644 --- a/src/app/submission/form/collection/submission-form-collection.component.spec.ts +++ b/src/app/submission/form/collection/submission-form-collection.component.spec.ts @@ -21,7 +21,7 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { Store } from '@ngrx/store'; import { TranslateModule } from '@ngx-translate/core'; import { cold } from 'jasmine-marbles'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { DSONameService } from '../../../core/breadcrumbs/dso-name.service'; import { CollectionDataService } from '../../../core/data/collection-data.service'; @@ -140,7 +140,7 @@ describe('SubmissionFormCollectionComponent Component', () => { }); const sectionsService: any = jasmine.createSpyObj('sectionsService', { - isSectionTypeAvailable: of(true), + isSectionTypeAvailable: observableOf(true), }); beforeEach(waitForAsync(() => { @@ -266,7 +266,7 @@ describe('SubmissionFormCollectionComponent Component', () => { }); it('the dropdown menu should be disabled', () => { - comp.available$ = of(false); + comp.available$ = observableOf(false); fixture.detectChanges(); const dropDown = fixture.debugElement.query(By.css('#collectionControlsDropdownMenu')); expect(dropDown).toBeFalsy(); @@ -292,7 +292,7 @@ describe('SubmissionFormCollectionComponent Component', () => { it('should change collection properly', () => { spyOn(comp.collectionChange, 'emit').and.callThrough(); - jsonPatchOpServiceStub.jsonPatchByResourceID.and.returnValue(of(submissionRestResponse)); + jsonPatchOpServiceStub.jsonPatchByResourceID.and.returnValue(observableOf(submissionRestResponse)); submissionServiceStub.retrieveSubmission.and.returnValue(createSuccessfulRemoteDataObject$(submissionRestResponse[0])); comp.ngOnInit(); comp.onSelect(mockCollectionList[1]); diff --git a/src/app/submission/sections/accesses/section-accesses.component.ts b/src/app/submission/sections/accesses/section-accesses.component.ts index b47f1cf8ff0..a6fb0e81e8f 100644 --- a/src/app/submission/sections/accesses/section-accesses.component.ts +++ b/src/app/submission/sections/accesses/section-accesses.component.ts @@ -24,7 +24,7 @@ import { TranslateService } from '@ngx-translate/core'; import { combineLatest, Observable, - of, + of as observableOf, Subscription, } from 'rxjs'; import { @@ -309,7 +309,7 @@ export class SubmissionSectionAccessesComponent extends SectionModelComponent { * the section status */ protected getSectionStatus(): Observable { - return of(true); + return observableOf(true); } /** diff --git a/src/app/submission/sections/section-coar-notify/coar-notify-config-data.service.spec.ts b/src/app/submission/sections/section-coar-notify/coar-notify-config-data.service.spec.ts index cfad518b852..c9962b4dc42 100644 --- a/src/app/submission/sections/section-coar-notify/coar-notify-config-data.service.spec.ts +++ b/src/app/submission/sections/section-coar-notify/coar-notify-config-data.service.spec.ts @@ -2,7 +2,7 @@ import { cold, getTestScheduler, } from 'jasmine-marbles'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service'; @@ -65,12 +65,12 @@ describe('CoarNotifyConfigDataService test', () => { generateRequestId: requestUUID, send: true, removeByHrefSubstring: {}, - getByHref: of(responseCacheEntry), - getByUUID: of(responseCacheEntry), + getByHref: observableOf(responseCacheEntry), + getByUUID: observableOf(responseCacheEntry), }); halService = jasmine.createSpyObj('halService', { - getEndpoint: of(endpointURL), + getEndpoint: observableOf(endpointURL), }); rdbService = jasmine.createSpyObj('rdbService', { diff --git a/src/app/submission/sections/section-coar-notify/section-coar-notify.component.spec.ts b/src/app/submission/sections/section-coar-notify/section-coar-notify.component.spec.ts index 635b0a9f444..881a84c2884 100644 --- a/src/app/submission/sections/section-coar-notify/section-coar-notify.component.spec.ts +++ b/src/app/submission/sections/section-coar-notify/section-coar-notify.component.spec.ts @@ -5,7 +5,7 @@ import { } from '@angular/core/testing'; import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { LdnServicesService } from '../../../admin/admin-ldn-services/ldn-services-data/ldn-services-data.service'; import { NotifyServicePattern } from '../../../admin/admin-ldn-services/ldn-services-model/ldn-service-patterns.model'; @@ -87,7 +87,7 @@ describe('SubmissionSectionCoarNotifyComponent', () => { component.patterns = patterns[0].patterns; coarNotifyConfigDataService.findAll.and.returnValue(coarNotifyConfig); sectionService.getSectionServerErrors.and.returnValue( - of( + observableOf( Object.assign([], { path: 'sections/sectionId/data/notifyCoar', message: 'error', @@ -264,7 +264,7 @@ describe('SubmissionSectionCoarNotifyComponent', () => { component.patterns = [pattern1, pattern2]; spyOn(component, 'filterServices').and.callFake((pattern) => { - return of(services); + return observableOf(services); }); }); @@ -417,7 +417,7 @@ describe('SubmissionSectionCoarNotifyComponent', () => { { path: 'sections/sectionId/data/notifyCoar', message: 'error' }, ]; sectionService.getSectionServerErrors.and.returnValue( - of(validationErrors), + observableOf(validationErrors), ); componentAsAny.getSectionServerErrorsAndSetErrorsToDisplay(); @@ -432,8 +432,8 @@ describe('SubmissionSectionCoarNotifyComponent', () => { describe('onSectionDestroy', () => { it('should unsubscribe from all subscriptions', () => { - const sub1 = of(null).subscribe(); - const sub2 = of(null).subscribe(); + const sub1 = observableOf(null).subscribe(); + const sub2 = observableOf(null).subscribe(); componentAsAny.subs = [sub1, sub2]; spyOn(sub1, 'unsubscribe'); spyOn(sub2, 'unsubscribe'); diff --git a/src/app/submission/sections/sherpa-policies/section-sherpa-policies.component.ts b/src/app/submission/sections/sherpa-policies/section-sherpa-policies.component.ts index 86d55ce8d00..40077851c97 100644 --- a/src/app/submission/sections/sherpa-policies/section-sherpa-policies.component.ts +++ b/src/app/submission/sections/sherpa-policies/section-sherpa-policies.component.ts @@ -12,7 +12,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { BehaviorSubject, Observable, - of, + of as observableOf, Subscription, } from 'rxjs'; @@ -136,7 +136,7 @@ export class SubmissionSectionSherpaPoliciesComponent extends SectionModelCompon * the section status */ protected getSectionStatus(): Observable { - return of(true); + return observableOf(true); } /** 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 015ccd4ae41..8d3064aab5d 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 @@ -28,7 +28,7 @@ import { import { provideMockStore } from '@ngrx/store/testing'; import { TranslateModule } from '@ngx-translate/core'; import { NgxMaskModule } from 'ngx-mask'; -import { of } from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { APP_CONFIG, @@ -215,7 +215,7 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => { comp.configMetadataForm = configMetadataForm; comp.formMetadata = formMetadataMock; - formService.isValid.and.returnValue(of(true)); + formService.isValid.and.returnValue(observableOf(true)); }); afterEach(() => { @@ -306,8 +306,8 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => { compAsAny.pathCombiner = pathCombiner; compAsAny.isPrimary = null; formService.validateAllFormFields.and.callFake(() => null); - formService.isValid.and.returnValue(of(true)); - formService.getFormData.and.returnValue(of(mockFileFormData)); + formService.isValid.and.returnValue(observableOf(true)); + formService.getFormData.and.returnValue(observableOf(mockFileFormData)); const response = [ Object.assign(mockSubmissionObject, { @@ -319,7 +319,7 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => { }, }), ]; - operationsService.jsonPatchByResourceID.and.returnValue(of(response)); + operationsService.jsonPatchByResourceID.and.returnValue(observableOf(response)); const accessConditionsToSave = [ { name: 'openaccess' }, @@ -364,8 +364,8 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => { compAsAny.fileData = fileData; compAsAny.pathCombiner = pathCombiner; formService.validateAllFormFields.and.callFake(() => null); - formService.isValid.and.returnValue(of(true)); - formService.getFormData.and.returnValue(of(noAccessConditionsMock)); + formService.isValid.and.returnValue(observableOf(true)); + formService.getFormData.and.returnValue(observableOf(noAccessConditionsMock)); const response = [ Object.assign(mockSubmissionObject, { sections: { @@ -375,7 +375,7 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => { }, }), ]; - operationsService.jsonPatchByResourceID.and.returnValue(of(response)); + operationsService.jsonPatchByResourceID.and.returnValue(observableOf(response)); comp.saveBitstreamData(); tick(); expect(uploadService.updateFileData).toHaveBeenCalled(); @@ -385,7 +385,7 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => { compAsAny.formRef = { formGroup: null }; compAsAny.pathCombiner = pathCombiner; formService.validateAllFormFields.and.callFake(() => null); - formService.isValid.and.returnValue(of(false)); + formService.isValid.and.returnValue(observableOf(false)); comp.saveBitstreamData(); tick(); 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 c1487b0559d..5005cb7db58 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 @@ -18,10 +18,7 @@ import { NgbModule, } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; -import { - of as observableOf, - of, -} from 'rxjs'; +import { of as observableOf } from 'rxjs'; import { APP_DATA_SERVICES_MAP } from '../../../../../config/app-config.interface'; import { JsonPatchOperationPathCombiner } from '../../../../core/json-patch/builder/json-patch-operation-path-combiner'; @@ -296,7 +293,7 @@ class TestComponent { availableAccessConditionOptions; collectionId = mockSubmissionCollectionId; collectionPolicyType; - configMetadataForm$ = of(configMetadataFormMock); + configMetadataForm$ = observableOf(configMetadataFormMock); fileIndexes = []; fileList = []; fileNames = [];