mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
55693: JSDocs and Test fixes
This commit is contained in:
@@ -32,6 +32,11 @@ import { By } from '@angular/platform-browser';
|
|||||||
import { RestResponse } from '../../core/cache/response-cache.models';
|
import { RestResponse } from '../../core/cache/response-cache.models';
|
||||||
import { PaginatedList } from '../../core/data/paginated-list';
|
import { PaginatedList } from '../../core/data/paginated-list';
|
||||||
import { PageInfo } from '../../core/shared/page-info.model';
|
import { PageInfo } from '../../core/shared/page-info.model';
|
||||||
|
import { CollectionDataService } from '../../core/data/collection-data.service';
|
||||||
|
import { ItemSelectService } from '../../shared/item-select/item-select.service';
|
||||||
|
import { PaginationComponent } from '../../shared/pagination/pagination.component';
|
||||||
|
import { EnumKeysPipe } from '../../shared/utils/enum-keys-pipe';
|
||||||
|
import { ItemSelectServiceStub } from '../../shared/testing/item-select-service-stub';
|
||||||
|
|
||||||
describe('CollectionItemMapperComponent', () => {
|
describe('CollectionItemMapperComponent', () => {
|
||||||
let comp: CollectionItemMapperComponent;
|
let comp: CollectionItemMapperComponent;
|
||||||
@@ -74,14 +79,18 @@ describe('CollectionItemMapperComponent', () => {
|
|||||||
onTranslationChange: new EventEmitter(),
|
onTranslationChange: new EventEmitter(),
|
||||||
onDefaultLangChange: new EventEmitter()
|
onDefaultLangChange: new EventEmitter()
|
||||||
};
|
};
|
||||||
|
const emptyList = new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []));
|
||||||
const searchServiceStub = Object.assign(new SearchServiceStub(), {
|
const searchServiceStub = Object.assign(new SearchServiceStub(), {
|
||||||
search: () => Observable.of(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), [])))
|
search: () => Observable.of(emptyList)
|
||||||
});
|
});
|
||||||
|
const collectionDataServiceStub = {
|
||||||
|
getMappedItems: () => Observable.of(emptyList)
|
||||||
|
};
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, FormsModule, SharedModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()],
|
imports: [CommonModule, FormsModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()],
|
||||||
declarations: [CollectionItemMapperComponent],
|
declarations: [CollectionItemMapperComponent, ItemSelectComponent, SearchFormComponent, PaginationComponent, EnumKeysPipe],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: ActivatedRoute, useValue: activatedRouteStub },
|
{ provide: ActivatedRoute, useValue: activatedRouteStub },
|
||||||
{ provide: Router, useValue: routerStub },
|
{ provide: Router, useValue: routerStub },
|
||||||
@@ -89,8 +98,10 @@ describe('CollectionItemMapperComponent', () => {
|
|||||||
{ provide: SearchService, useValue: searchServiceStub },
|
{ provide: SearchService, useValue: searchServiceStub },
|
||||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||||
{ provide: ItemDataService, useValue: itemDataServiceStub },
|
{ provide: ItemDataService, useValue: itemDataServiceStub },
|
||||||
|
{ provide: CollectionDataService, useValue: collectionDataServiceStub },
|
||||||
{ provide: TranslateService, useValue: translateServiceStub },
|
{ provide: TranslateService, useValue: translateServiceStub },
|
||||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) }
|
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
||||||
|
{ provide: ItemSelectService, useValue: new ItemSelectServiceStub() }
|
||||||
]
|
]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
@@ -175,6 +175,11 @@ export class CollectionItemMapperComponent implements OnInit {
|
|||||||
return this.router.url;
|
return this.router.url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a query where items that are already mapped to a collection are excluded from
|
||||||
|
* @param collectionId The collection's UUID
|
||||||
|
* @param query The query to add to it
|
||||||
|
*/
|
||||||
buildQuery(collectionId: string, query: string): string {
|
buildQuery(collectionId: string, query: string): string {
|
||||||
const excludeColQuery = `-location.coll:\"${collectionId}\"`;
|
const excludeColQuery = `-location.coll:\"${collectionId}\"`;
|
||||||
if (isNotEmpty(query)) {
|
if (isNotEmpty(query)) {
|
||||||
|
Reference in New Issue
Block a user