mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +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 { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||||
import { SearchFormComponent } from '../../shared/search-form/search-form.component';
|
import { SearchFormComponent } from '../../shared/search-form/search-form.component';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { ActivatedRouteStub } from '../../shared/testing/active-router.stub';
|
|
||||||
import { RouterStub } from '../../shared/testing/router.stub';
|
import { RouterStub } from '../../shared/testing/router.stub';
|
||||||
import { SearchServiceStub } from '../../shared/testing/search-service.stub';
|
import { SearchServiceStub } from '../../shared/testing/search-service.stub';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
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 { ObjectSelectService } from '../../shared/object-select/object-select.service';
|
||||||
import { ObjectSelectServiceStub } from '../../shared/testing/object-select-service.stub';
|
import { ObjectSelectServiceStub } from '../../shared/testing/object-select-service.stub';
|
||||||
import { VarDirective } from '../../shared/utils/var.directive';
|
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 { RouteService } from '../../core/services/route.service';
|
||||||
import { ErrorComponent } from '../../shared/error/error.component';
|
import { ErrorComponent } from '../../shared/error/error.component';
|
||||||
import { LoadingComponent } from '../../shared/loading/loading.component';
|
import { LoadingComponent } from '../../shared/loading/loading.component';
|
||||||
@@ -66,7 +65,7 @@ describe('CollectionItemMapperComponent', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
const mockCollectionRD: RemoteData<Collection> = createSuccessfulRemoteDataObject(mockCollection);
|
const mockCollectionRD: RemoteData<Collection> = createSuccessfulRemoteDataObject(mockCollection);
|
||||||
const mockSearchOptions = of(new PaginatedSearchOptions({
|
const mockSearchOptions = observableOf(new PaginatedSearchOptions({
|
||||||
pagination: Object.assign(new PaginationComponentOptions(), {
|
pagination: Object.assign(new PaginationComponentOptions(), {
|
||||||
id: 'search-page-configuration',
|
id: 'search-page-configuration',
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@@ -88,23 +87,34 @@ describe('CollectionItemMapperComponent', () => {
|
|||||||
const emptyList = createSuccessfulRemoteDataObject(createPaginatedList([]));
|
const emptyList = createSuccessfulRemoteDataObject(createPaginatedList([]));
|
||||||
const itemDataServiceStub = {
|
const itemDataServiceStub = {
|
||||||
mapToCollection: () => createSuccessfulRemoteDataObject$({}),
|
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 = {
|
const translateServiceStub = {
|
||||||
get: () => of('test-message of collection ' + mockCollection.name),
|
get: () => observableOf('test-message of collection ' + mockCollection.name),
|
||||||
onLangChange: new EventEmitter(),
|
onLangChange: new EventEmitter(),
|
||||||
onTranslationChange: new EventEmitter(),
|
onTranslationChange: new EventEmitter(),
|
||||||
onDefaultLangChange: new EventEmitter()
|
onDefaultLangChange: new EventEmitter()
|
||||||
};
|
};
|
||||||
const searchServiceStub = Object.assign(new SearchServiceStub(), {
|
const searchServiceStub = Object.assign(new SearchServiceStub(), {
|
||||||
search: () => of(emptyList),
|
search: () => observableOf(emptyList),
|
||||||
/* tslint:disable:no-empty */
|
/* tslint:disable:no-empty */
|
||||||
clearDiscoveryRequests: () => {}
|
clearDiscoveryRequests: () => {}
|
||||||
/* tslint:enable:no-empty */
|
/* tslint:enable:no-empty */
|
||||||
});
|
});
|
||||||
const collectionDataServiceStub = {
|
const collectionDataServiceStub = {
|
||||||
getMappedItems: () => of(emptyList),
|
getMappedItems: () => observableOf(emptyList),
|
||||||
/* tslint:disable:no-empty */
|
/* tslint:disable:no-empty */
|
||||||
clearMappedItemsRequests: () => {}
|
clearMappedItemsRequests: () => {}
|
||||||
/* tslint:enable:no-empty */
|
/* tslint:enable:no-empty */
|
||||||
|
@@ -143,7 +143,7 @@ export class CollectionItemMapperComponent implements OnInit {
|
|||||||
sort: this.defaultSortOptions
|
sort: this.defaultSortOptions
|
||||||
}),!shouldUpdate, false, followLink('owningCollection')).pipe(
|
}),!shouldUpdate, false, followLink('owningCollection')).pipe(
|
||||||
getAllSucceededRemoteData()
|
getAllSucceededRemoteData()
|
||||||
)
|
);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
this.mappedItemsRD$ = collectionAndOptions$.pipe(
|
this.mappedItemsRD$ = collectionAndOptions$.pipe(
|
||||||
|
@@ -80,14 +80,14 @@ describe('ItemCollectionMapperComponent', () => {
|
|||||||
const itemDataServiceStub = {
|
const itemDataServiceStub = {
|
||||||
mapToCollection: () => createSuccessfulRemoteDataObject$({}),
|
mapToCollection: () => createSuccessfulRemoteDataObject$({}),
|
||||||
removeMappingFromCollection: () => createSuccessfulRemoteDataObject$({}),
|
removeMappingFromCollection: () => createSuccessfulRemoteDataObject$({}),
|
||||||
getMappedCollectionsEndpoint: () => of('rest/api/mappedCollectionsEndpoint'),
|
getMappedCollectionsEndpoint: () => observableOf('rest/api/mappedCollectionsEndpoint'),
|
||||||
getMappedCollections: () => observableOf(mockCollectionsRD),
|
getMappedCollections: () => observableOf(mockCollectionsRD),
|
||||||
/* tslint:disable:no-empty */
|
/* tslint:disable:no-empty */
|
||||||
clearMappedCollectionsRequests: () => {}
|
clearMappedCollectionsRequests: () => {}
|
||||||
/* tslint:enable:no-empty */
|
/* tslint:enable:no-empty */
|
||||||
};
|
};
|
||||||
const collectionDataServiceStub = {
|
const collectionDataServiceStub = {
|
||||||
findAllByHref: () => of(mockCollectionsRD)
|
findAllByHref: () => observableOf(mockCollectionsRD)
|
||||||
};
|
};
|
||||||
const searchServiceStub = Object.assign(new SearchServiceStub(), {
|
const searchServiceStub = Object.assign(new SearchServiceStub(), {
|
||||||
search: () => observableOf(mockCollectionsRD),
|
search: () => observableOf(mockCollectionsRD),
|
||||||
|
Reference in New Issue
Block a user