mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
75413: test fixes
This commit is contained in:
@@ -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<Collection> = 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 */
|
||||
|
@@ -143,7 +143,7 @@ export class CollectionItemMapperComponent implements OnInit {
|
||||
sort: this.defaultSortOptions
|
||||
}),!shouldUpdate, false, followLink('owningCollection')).pipe(
|
||||
getAllSucceededRemoteData()
|
||||
)
|
||||
);
|
||||
})
|
||||
);
|
||||
this.mappedItemsRD$ = collectionAndOptions$.pipe(
|
||||
|
@@ -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),
|
||||
|
Reference in New Issue
Block a user