mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
CST-5249_suggestion test fixes
This commit is contained in:
@@ -77,23 +77,26 @@ describe('WorkspaceitemDataService test', () => {
|
|||||||
const notificationsService = {} as NotificationsService;
|
const notificationsService = {} as NotificationsService;
|
||||||
const http = {} as HttpClient;
|
const http = {} as HttpClient;
|
||||||
const comparator = {} as any;
|
const comparator = {} as any;
|
||||||
const comparatorEntry = {} as any;
|
|
||||||
const store = {} as Store<CoreState>;
|
const store = {} as Store<CoreState>;
|
||||||
const pageInfo = new PageInfo();
|
const pageInfo = new PageInfo();
|
||||||
|
|
||||||
function initTestService() {
|
function initTestService() {
|
||||||
hrefOnlyDataService = getMockHrefOnlyDataService();
|
hrefOnlyDataService = getMockHrefOnlyDataService();
|
||||||
return new WorkspaceitemDataService(
|
return new WorkspaceitemDataService(
|
||||||
|
comparator,
|
||||||
|
halService,
|
||||||
|
http,
|
||||||
|
notificationsService,
|
||||||
requestService,
|
requestService,
|
||||||
rdbService,
|
rdbService,
|
||||||
objectCache,
|
objectCache,
|
||||||
halService,
|
store
|
||||||
notificationsService,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('composition', () => {
|
describe('composition', () => {
|
||||||
const initService = () => new WorkspaceitemDataService(null, null, null, null, null);
|
const initService = () => new WorkspaceitemDataService(null, null,
|
||||||
|
null, null, null, null, null, null);
|
||||||
testSearchDataImplementation(initService);
|
testSearchDataImplementation(initService);
|
||||||
testDeleteDataImplementation(initService);
|
testDeleteDataImplementation(initService);
|
||||||
});
|
});
|
||||||
|
@@ -23,15 +23,19 @@ import {hasValue} from '../../shared/empty.util';
|
|||||||
import { IdentifiableDataService } from '../data/base/identifiable-data.service';
|
import { IdentifiableDataService } from '../data/base/identifiable-data.service';
|
||||||
import { NoContent } from '../shared/NoContent.model';
|
import { NoContent } from '../shared/NoContent.model';
|
||||||
import { DeleteData, DeleteDataImpl } from '../data/base/delete-data';
|
import { DeleteData, DeleteDataImpl } from '../data/base/delete-data';
|
||||||
|
import { SearchData, SearchDataImpl } from '../data/base/search-data';
|
||||||
|
import { Bitstream } from '../shared/bitstream.model';
|
||||||
|
import { PaginatedList } from '../data/paginated-list.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A service that provides methods to make REST requests with workspaceitems endpoint.
|
* A service that provides methods to make REST requests with workspaceitems endpoint.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@dataService(WorkspaceItem.type)
|
@dataService(WorkspaceItem.type)
|
||||||
export class WorkspaceitemDataService extends IdentifiableDataService<WorkspaceItem> {
|
export class WorkspaceitemDataService extends IdentifiableDataService<WorkspaceItem> implements SearchData<WorkspaceItem>, DeleteData<WorkspaceItem> {
|
||||||
protected linkPath = 'workspaceitems';
|
protected linkPath = 'workspaceitems';
|
||||||
protected searchByItemLinkPath = 'item';
|
protected searchByItemLinkPath = 'item';
|
||||||
|
private searchData: SearchDataImpl<WorkspaceItem>;
|
||||||
private deleteData: DeleteData<WorkspaceItem>;
|
private deleteData: DeleteData<WorkspaceItem>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -45,6 +49,7 @@ export class WorkspaceitemDataService extends IdentifiableDataService<WorkspaceI
|
|||||||
protected store: Store<CoreState>) {
|
protected store: Store<CoreState>) {
|
||||||
super('workspaceitems', requestService, rdbService, objectCache, halService);
|
super('workspaceitems', requestService, rdbService, objectCache, halService);
|
||||||
this.deleteData = new DeleteDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive, this.constructIdEndpoint);
|
this.deleteData = new DeleteDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive, this.constructIdEndpoint);
|
||||||
|
this.searchData = new SearchDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
|
||||||
|
|
||||||
}
|
}
|
||||||
public delete(objectId: string, copyVirtualMetadata?: string[]): Observable<RemoteData<NoContent>> {
|
public delete(objectId: string, copyVirtualMetadata?: string[]): Observable<RemoteData<NoContent>> {
|
||||||
@@ -93,4 +98,34 @@ export class WorkspaceitemDataService extends IdentifiableDataService<WorkspaceI
|
|||||||
return this.rdbService.buildFromRequestUUID(requestId);
|
return this.rdbService.buildFromRequestUUID(requestId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a new FindListRequest with given search method
|
||||||
|
*
|
||||||
|
* @param searchMethod The search method for the object
|
||||||
|
* @param options The [[FindListOptions]] object
|
||||||
|
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
|
||||||
|
* no valid cached version. Defaults to true
|
||||||
|
* @param reRequestOnStale Whether or not the request should automatically be re-
|
||||||
|
* requested after the response becomes stale
|
||||||
|
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which
|
||||||
|
* {@link HALLink}s should be automatically resolved
|
||||||
|
* @return {Observable<RemoteData<PaginatedList<T>>}
|
||||||
|
* Return an observable that emits response from the server
|
||||||
|
*/
|
||||||
|
public searchBy(searchMethod: string, options?: FindListOptions, useCachedVersionIfAvailable?: boolean, reRequestOnStale?: boolean, ...linksToFollow: FollowLinkConfig<WorkspaceItem>[]): Observable<RemoteData<PaginatedList<WorkspaceItem>>> {
|
||||||
|
return this.searchData.searchBy(searchMethod, options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an existing object on the server
|
||||||
|
* @param href The self link of the object to be removed
|
||||||
|
* @param copyVirtualMetadata (optional parameter) the identifiers of the relationship types for which the virtual
|
||||||
|
* metadata should be saved as real metadata
|
||||||
|
* @return A RemoteData observable with an empty payload, but still representing the state of the request: statusCode,
|
||||||
|
* errorMessage, timeCompleted, etc
|
||||||
|
* Only emits once all request related to the DSO has been invalidated.
|
||||||
|
*/
|
||||||
|
deleteByHref(href: string, copyVirtualMetadata?: string[]): Observable<RemoteData<NoContent>> {
|
||||||
|
return this.deleteData.deleteByHref(href, copyVirtualMetadata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -71,6 +71,7 @@ describe('SuggestionsPopupComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should show a notification when new publication suggestions are available', () => {
|
it('should show a notification when new publication suggestions are available', () => {
|
||||||
|
|
||||||
expect((component as any).notificationsService.success).toHaveBeenCalled();
|
expect((component as any).notificationsService.success).toHaveBeenCalled();
|
||||||
expect(suggestionStateService.dispatchMarkUserSuggestionsAsVisitedAction).toHaveBeenCalled();
|
expect(suggestionStateService.dispatchMarkUserSuggestionsAsVisitedAction).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
@@ -14,7 +14,7 @@ import { AuthConfig } from './auth-config.interfaces';
|
|||||||
import { UIServerConfig } from './ui-server-config.interface';
|
import { UIServerConfig } from './ui-server-config.interface';
|
||||||
import { MediaViewerConfig } from './media-viewer-config.interface';
|
import { MediaViewerConfig } from './media-viewer-config.interface';
|
||||||
import { BrowseByConfig } from './browse-by-config.interface';
|
import { BrowseByConfig } from './browse-by-config.interface';
|
||||||
import {SuggestionConfig} from './layout-config.interfaces';
|
import { SuggestionConfig } from './layout-config.interfaces';
|
||||||
import { BundleConfig } from './bundle-config.interface';
|
import { BundleConfig } from './bundle-config.interface';
|
||||||
import { ActuatorsConfig } from './actuators.config';
|
import { ActuatorsConfig } from './actuators.config';
|
||||||
import { InfoConfig } from './info-config.interface';
|
import { InfoConfig } from './info-config.interface';
|
||||||
|
@@ -4,6 +4,7 @@ import { RestRequestMethod } from '../app/core/data/rest-request-method';
|
|||||||
import { NotificationAnimationsType } from '../app/shared/notifications/models/notification-animations-type';
|
import { NotificationAnimationsType } from '../app/shared/notifications/models/notification-animations-type';
|
||||||
|
|
||||||
export const environment: BuildConfig = {
|
export const environment: BuildConfig = {
|
||||||
|
suggestion: [],
|
||||||
production: false,
|
production: false,
|
||||||
|
|
||||||
// Angular Universal settings
|
// Angular Universal settings
|
||||||
|
Reference in New Issue
Block a user