mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
Merge branch 'main-gh4s' into CST-7757
# Conflicts: # src/app/collection-page/collection-page.component.html # src/app/community-page/community-page.component.html # src/app/core/core.module.ts # src/app/core/data/feature-authorization/feature-id.ts # src/app/shared/shared.module.ts
This commit is contained in:
@@ -55,7 +55,8 @@ export class ActivatedRouteStub {
|
||||
return {
|
||||
params: this.testParams,
|
||||
paramMap: convertToParamMap(this.params),
|
||||
queryParamMap: convertToParamMap(this.testParams)
|
||||
queryParamMap: convertToParamMap(this.testParams),
|
||||
queryParams: {} as Params,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
13
src/app/shared/testing/base-data-service.stub.ts
Normal file
13
src/app/shared/testing/base-data-service.stub.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { CacheableObject } from '../../core/cache/cacheable-object.model';
|
||||
|
||||
/**
|
||||
* Stub class for {@link BaseDataService}
|
||||
*/
|
||||
export abstract class BaseDataServiceStub<T extends CacheableObject> {
|
||||
|
||||
invalidateByHref(_href: string): Observable<boolean> {
|
||||
return observableOf(true);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
import { EMPTY, Observable, of as observableOf } from 'rxjs';
|
||||
import { RemoteData } from '../../core/data/remote-data';
|
||||
import { buildPaginatedList, PaginatedList } from '../../core/data/paginated-list.model';
|
||||
import { BrowseDefinition } from '../../core/shared/browse-definition.model';
|
||||
import { BrowseService } from '../../core/browse/browse.service';
|
||||
import { createSuccessfulRemoteDataObject } from '../remote-data.utils';
|
||||
import { PageInfo } from '../../core/shared/page-info.model';
|
||||
|
||||
// This data is in post-serialized form (metadata -> metadataKeys)
|
||||
export const mockData: BrowseDefinition[] = [
|
||||
Object.assign(new BrowseDefinition, {
|
||||
'id' : 'dateissued',
|
||||
'metadataBrowse' : false,
|
||||
'dataType' : 'date',
|
||||
'sortOptions' : EMPTY,
|
||||
'order' : 'ASC',
|
||||
'type' : 'browse',
|
||||
'metadataKeys' : [ 'dc.date.issued' ],
|
||||
'_links' : EMPTY
|
||||
}),
|
||||
Object.assign(new BrowseDefinition, {
|
||||
'id' : 'author',
|
||||
'metadataBrowse' : true,
|
||||
'dataType' : 'text',
|
||||
'sortOptions' : EMPTY,
|
||||
'order' : 'ASC',
|
||||
'type' : 'browse',
|
||||
'metadataKeys' : [ 'dc.contributor.*', 'dc.creator' ],
|
||||
'_links' : EMPTY
|
||||
})
|
||||
];
|
||||
|
||||
export const BrowseDefinitionDataServiceStub: any = {
|
||||
|
||||
/**
|
||||
* Get all BrowseDefinitions
|
||||
*/
|
||||
findAll(): Observable<RemoteData<PaginatedList<BrowseDefinition>>> {
|
||||
return observableOf(createSuccessfulRemoteDataObject(buildPaginatedList(new PageInfo(), mockData)));
|
||||
},
|
||||
|
||||
/**
|
||||
* Get all BrowseDefinitions with any link configuration
|
||||
*/
|
||||
findAllLinked(): Observable<RemoteData<PaginatedList<BrowseDefinition>>> {
|
||||
return observableOf(createSuccessfulRemoteDataObject(buildPaginatedList(new PageInfo(), mockData)));
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the browse URL by providing a list of metadata keys
|
||||
*
|
||||
* @param metadataKeys a list of fields eg. ['dc.contributor.author', 'dc.creator']
|
||||
*/
|
||||
findByFields(metadataKeys: string[]): Observable<RemoteData<BrowseDefinition>> {
|
||||
let searchKeyArray: string[] = [];
|
||||
metadataKeys.forEach((metadataKey) => {
|
||||
searchKeyArray = searchKeyArray.concat(BrowseService.toSearchKeyArray(metadataKey));
|
||||
});
|
||||
// Return just the first, as a pretend match
|
||||
return observableOf(createSuccessfulRemoteDataObject(mockData[0]));
|
||||
}
|
||||
|
||||
};
|
16
src/app/shared/testing/claimed-task-data-service.stub.ts
Normal file
16
src/app/shared/testing/claimed-task-data-service.stub.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Observable, EMPTY } from 'rxjs';
|
||||
import { ProcessTaskResponse } from '../../core/tasks/models/process-task-response';
|
||||
import { ClaimedTask } from '../../core/tasks/models/claimed-task-object.model';
|
||||
import { RemoteData } from '../../core/data/remote-data';
|
||||
|
||||
export class ClaimedTaskDataServiceStub {
|
||||
|
||||
public submitTask(_scopeId: string, _body: any): Observable<ProcessTaskResponse> {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
public findByItem(_uuid: string): Observable<RemoteData<ClaimedTask>> {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
|
||||
export class DataServiceStub {
|
||||
|
||||
invalidateByHref(_href: string): Observable<boolean> {
|
||||
return observableOf(true);
|
||||
}
|
||||
|
||||
}
|
16
src/app/shared/testing/identifiable-data-service.stub.ts
Normal file
16
src/app/shared/testing/identifiable-data-service.stub.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { CacheableObject } from '../../core/cache/cacheable-object.model';
|
||||
import { BaseDataServiceStub } from './base-data-service.stub';
|
||||
import { FollowLinkConfig } from '../utils/follow-link-config.model';
|
||||
import { Observable, EMPTY } from 'rxjs';
|
||||
import { RemoteData } from '../../core/data/remote-data';
|
||||
|
||||
/**
|
||||
* Stub class for {@link IdentifiableDataService}
|
||||
*/
|
||||
export class IdentifiableDataServiceStub<T extends CacheableObject> extends BaseDataServiceStub<T> {
|
||||
|
||||
findById(_id: string, _useCachedVersionIfAvailable = true, _reRequestOnStale = true, ..._linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<T>> {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
}
|
7
src/app/shared/testing/location.stub.ts
Normal file
7
src/app/shared/testing/location.stub.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export class LocationStub {
|
||||
|
||||
getState(): unknown {
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
12
src/app/shared/testing/request-service.stub.ts
Normal file
12
src/app/shared/testing/request-service.stub.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
|
||||
/**
|
||||
* Stub service for {@link RequestService}.
|
||||
*/
|
||||
export class RequestServiceStub {
|
||||
|
||||
removeByHrefSubstring(_href: string): Observable<boolean> {
|
||||
return observableOf(true);
|
||||
}
|
||||
|
||||
}
|
18
src/app/shared/testing/workflow-action-data-service.stub.ts
Normal file
18
src/app/shared/testing/workflow-action-data-service.stub.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { FindListOptions } from '../../core/data/find-list-options.model';
|
||||
import { FollowLinkConfig } from '../utils/follow-link-config.model';
|
||||
import { WorkspaceItem } from '../../core/submission/models/workspaceitem.model';
|
||||
import { Observable, EMPTY } from 'rxjs';
|
||||
import { RemoteData } from '../../core/data/remote-data';
|
||||
import { WorkflowItem } from '../../core/submission/models/workflowitem.model';
|
||||
import { IdentifiableDataServiceStub } from './identifiable-data-service.stub';
|
||||
|
||||
/**
|
||||
* Stub class for {@link WorkflowActionDataService}
|
||||
*/
|
||||
export class WorkflowActionDataServiceStub extends IdentifiableDataServiceStub<WorkflowItem> {
|
||||
|
||||
public findByItem(_uuid: string, _useCachedVersionIfAvailable = false, _reRequestOnStale = true, _options: FindListOptions = {}, ..._linksToFollow: FollowLinkConfig<WorkspaceItem>[]): Observable<RemoteData<WorkspaceItem>> {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
import { WorkflowItem } from '../../core/submission/models/workflowitem.model';
|
||||
import { IdentifiableDataServiceStub } from './identifiable-data-service.stub';
|
||||
|
||||
/**
|
||||
* Stub class for {@link WorkflowItemDataService}
|
||||
*/
|
||||
export class WorkflowItemDataServiceStub extends IdentifiableDataServiceStub<WorkflowItem> {
|
||||
}
|
Reference in New Issue
Block a user