diff --git a/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.spec.ts b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.spec.ts index 71bf5c2ac4..49b6a0d63c 100644 --- a/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.spec.ts +++ b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.spec.ts @@ -6,7 +6,6 @@ import { CommonModule } from '@angular/common'; import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { SearchFormComponent } from '../../shared/search-form/search-form.component'; import { ActivatedRoute, Router } from '@angular/router'; -import { ActivatedRouteStub } from '../../shared/testing/active-router.stub'; import { RouterStub } from '../../shared/testing/router.stub'; import { SearchServiceStub } from '../../shared/testing/search-service.stub'; import { NotificationsService } from '../../shared/notifications/notifications.service'; @@ -28,7 +27,7 @@ import { ItemSelectComponent } from '../../shared/object-select/item-select/item import { ObjectSelectService } from '../../shared/object-select/object-select.service'; import { ObjectSelectServiceStub } from '../../shared/testing/object-select-service.stub'; import { VarDirective } from '../../shared/utils/var.directive'; -import { of as observableOf, of } from 'rxjs'; +import { of as observableOf } from 'rxjs/internal/observable/of'; import { RouteService } from '../../core/services/route.service'; import { ErrorComponent } from '../../shared/error/error.component'; import { LoadingComponent } from '../../shared/loading/loading.component'; @@ -66,7 +65,7 @@ describe('CollectionItemMapperComponent', () => { } }); const mockCollectionRD: RemoteData = createSuccessfulRemoteDataObject(mockCollection); - const mockSearchOptions = of(new PaginatedSearchOptions({ + const mockSearchOptions = observableOf(new PaginatedSearchOptions({ pagination: Object.assign(new PaginationComponentOptions(), { id: 'search-page-configuration', pageSize: 10, @@ -88,23 +87,34 @@ describe('CollectionItemMapperComponent', () => { const emptyList = createSuccessfulRemoteDataObject(createPaginatedList([])); const itemDataServiceStub = { mapToCollection: () => createSuccessfulRemoteDataObject$({}), - findAllByHref: () => of(emptyList) + findAllByHref: () => observableOf(emptyList) + }; + const activatedRouteStub = { + parent: { + data: observableOf({ + dso: mockCollectionRD + }) + }, + snapshot: { + queryParamMap: new Map([ + ['query', 'test'], + ]) + } }; - const activatedRouteStub = new ActivatedRouteStub({}, { dso: mockCollectionRD }); const translateServiceStub = { - get: () => of('test-message of collection ' + mockCollection.name), + get: () => observableOf('test-message of collection ' + mockCollection.name), onLangChange: new EventEmitter(), onTranslationChange: new EventEmitter(), onDefaultLangChange: new EventEmitter() }; const searchServiceStub = Object.assign(new SearchServiceStub(), { - search: () => of(emptyList), + search: () => observableOf(emptyList), /* tslint:disable:no-empty */ clearDiscoveryRequests: () => {} /* tslint:enable:no-empty */ }); const collectionDataServiceStub = { - getMappedItems: () => of(emptyList), + getMappedItems: () => observableOf(emptyList), /* tslint:disable:no-empty */ clearMappedItemsRequests: () => {} /* tslint:enable:no-empty */ diff --git a/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.ts b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.ts index 61494c983a..571b755897 100644 --- a/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.ts +++ b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.ts @@ -143,7 +143,7 @@ export class CollectionItemMapperComponent implements OnInit { sort: this.defaultSortOptions }),!shouldUpdate, false, followLink('owningCollection')).pipe( getAllSucceededRemoteData() - ) + ); }) ); this.mappedItemsRD$ = collectionAndOptions$.pipe( diff --git a/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.spec.ts b/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.spec.ts index 12c694517d..21c1879828 100644 --- a/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.spec.ts @@ -80,14 +80,14 @@ describe('ItemCollectionMapperComponent', () => { const itemDataServiceStub = { mapToCollection: () => createSuccessfulRemoteDataObject$({}), removeMappingFromCollection: () => createSuccessfulRemoteDataObject$({}), - getMappedCollectionsEndpoint: () => of('rest/api/mappedCollectionsEndpoint'), + getMappedCollectionsEndpoint: () => observableOf('rest/api/mappedCollectionsEndpoint'), getMappedCollections: () => observableOf(mockCollectionsRD), /* tslint:disable:no-empty */ clearMappedCollectionsRequests: () => {} /* tslint:enable:no-empty */ }; const collectionDataServiceStub = { - findAllByHref: () => of(mockCollectionsRD) + findAllByHref: () => observableOf(mockCollectionsRD) }; const searchServiceStub = Object.assign(new SearchServiceStub(), { search: () => observableOf(mockCollectionsRD),