mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Changed findEntryDetailByValue method name to a properly findEntryDetailById
This commit is contained in:
@@ -481,16 +481,16 @@ describe('VocabularyService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('findEntryDetailByValue', () => {
|
describe('findEntryDetailById', () => {
|
||||||
it('should proxy the call to vocabularyDataService.findVocabularyById', () => {
|
it('should proxy the call to vocabularyDataService.findVocabularyById', () => {
|
||||||
scheduler.schedule(() => service.findEntryDetailByValue('testValue', hierarchicalVocabulary.id));
|
scheduler.schedule(() => service.findEntryDetailById('testValue', hierarchicalVocabulary.id));
|
||||||
scheduler.flush();
|
scheduler.flush();
|
||||||
const expectedId = `${hierarchicalVocabulary.id}:testValue`
|
const expectedId = `${hierarchicalVocabulary.id}:testValue`
|
||||||
expect((service as any).vocabularyEntryDetailDataService.findById).toHaveBeenCalledWith(expectedId);
|
expect((service as any).vocabularyEntryDetailDataService.findById).toHaveBeenCalledWith(expectedId);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a RemoteData<VocabularyEntryDetail> for the object with the given id', () => {
|
it('should return a RemoteData<VocabularyEntryDetail> for the object with the given id', () => {
|
||||||
const result = service.findEntryDetailByValue('testValue', hierarchicalVocabulary.id);
|
const result = service.findEntryDetailById('testValue', hierarchicalVocabulary.id);
|
||||||
const expected = cold('a|', {
|
const expected = cold('a|', {
|
||||||
a: vocabularyEntryDetailParentRD
|
a: vocabularyEntryDetailParentRD
|
||||||
});
|
});
|
||||||
|
@@ -283,15 +283,15 @@ export class VocabularyService {
|
|||||||
/**
|
/**
|
||||||
* Returns an observable of {@link RemoteData} of a {@link VocabularyEntryDetail}, based on its ID, with a list of {@link FollowLinkConfig},
|
* Returns an observable of {@link RemoteData} of a {@link VocabularyEntryDetail}, based on its ID, with a list of {@link FollowLinkConfig},
|
||||||
* to automatically resolve {@link HALLink}s of the object
|
* to automatically resolve {@link HALLink}s of the object
|
||||||
* @param value The entry value for which to provide detailed information.
|
* @param id The entry id for which to provide detailed information.
|
||||||
* @param name The name of {@link Vocabulary} to which the entry belongs
|
* @param name The name of {@link Vocabulary} to which the entry belongs
|
||||||
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
|
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
|
||||||
* @return {Observable<RemoteData<VocabularyEntryDetail>>}
|
* @return {Observable<RemoteData<VocabularyEntryDetail>>}
|
||||||
* Return an observable that emits VocabularyEntryDetail object
|
* Return an observable that emits VocabularyEntryDetail object
|
||||||
*/
|
*/
|
||||||
findEntryDetailByValue(value: string, name: string, ...linksToFollow: Array<FollowLinkConfig<VocabularyEntryDetail>>): Observable<RemoteData<VocabularyEntryDetail>> {
|
findEntryDetailById(id: string, name: string, ...linksToFollow: Array<FollowLinkConfig<VocabularyEntryDetail>>): Observable<RemoteData<VocabularyEntryDetail>> {
|
||||||
const id = `${name}:${value}`;
|
const findId = `${name}:${id}`;
|
||||||
return this.vocabularyEntryDetailDataService.findById(id, ...linksToFollow);
|
return this.vocabularyEntryDetailDataService.findById(findId, ...linksToFollow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -233,7 +233,7 @@ export class DsDynamicRelationGroupComponent extends DynamicFormControlComponent
|
|||||||
if (isObject(valueObj[fieldName]) && valueObj[fieldName].hasAuthority() && isNotEmpty(valueObj[fieldName].authority)) {
|
if (isObject(valueObj[fieldName]) && valueObj[fieldName].hasAuthority() && isNotEmpty(valueObj[fieldName].authority)) {
|
||||||
const fieldId = fieldName.replace(/\./g, '_');
|
const fieldId = fieldName.replace(/\./g, '_');
|
||||||
const model = this.formBuilderService.findById(fieldId, this.formModel);
|
const model = this.formBuilderService.findById(fieldId, this.formModel);
|
||||||
return$ = this.vocabularyService.findEntryDetailByValue(
|
return$ = this.vocabularyService.findEntryDetailById(
|
||||||
valueObj[fieldName].authority,
|
valueObj[fieldName].authority,
|
||||||
(model as any).vocabularyOptions.name
|
(model as any).vocabularyOptions.name
|
||||||
).pipe(
|
).pipe(
|
||||||
|
@@ -57,7 +57,7 @@ describe('VocabularyTreeviewService test suite', () => {
|
|||||||
const vocabularyServiceStub = jasmine.createSpyObj('VocabularyService', {
|
const vocabularyServiceStub = jasmine.createSpyObj('VocabularyService', {
|
||||||
getVocabularyEntriesByValue: jasmine.createSpy('getVocabularyEntriesByValue'),
|
getVocabularyEntriesByValue: jasmine.createSpy('getVocabularyEntriesByValue'),
|
||||||
getEntryDetailParent: jasmine.createSpy('getEntryDetailParent'),
|
getEntryDetailParent: jasmine.createSpy('getEntryDetailParent'),
|
||||||
findEntryDetailByValue: jasmine.createSpy('findEntryDetailByValue'),
|
findEntryDetailById: jasmine.createSpy('findEntryDetailById'),
|
||||||
searchTopEntries: jasmine.createSpy('searchTopEntries'),
|
searchTopEntries: jasmine.createSpy('searchTopEntries'),
|
||||||
getEntryDetailChildren: jasmine.createSpy('getEntryDetailChildren'),
|
getEntryDetailChildren: jasmine.createSpy('getEntryDetailChildren'),
|
||||||
clearSearchTopRequests: jasmine.createSpy('clearSearchTopRequests')
|
clearSearchTopRequests: jasmine.createSpy('clearSearchTopRequests')
|
||||||
@@ -202,7 +202,7 @@ describe('VocabularyTreeviewService test suite', () => {
|
|||||||
serviceAsAny.vocabularyService.searchTopEntries.and.returnValue(hot('-c', {
|
serviceAsAny.vocabularyService.searchTopEntries.and.returnValue(hot('-c', {
|
||||||
a: createSuccessfulRemoteDataObject(new PaginatedList(pageInfo, [item, item2, item3]))
|
a: createSuccessfulRemoteDataObject(new PaginatedList(pageInfo, [item, item2, item3]))
|
||||||
}));
|
}));
|
||||||
serviceAsAny.vocabularyService.findEntryDetailByValue.and.returnValue(
|
serviceAsAny.vocabularyService.findEntryDetailById.and.returnValue(
|
||||||
hot('-a', {
|
hot('-a', {
|
||||||
a: createSuccessfulRemoteDataObject(child2)
|
a: createSuccessfulRemoteDataObject(child2)
|
||||||
})
|
})
|
||||||
@@ -303,7 +303,7 @@ describe('VocabularyTreeviewService test suite', () => {
|
|||||||
a: createSuccessfulRemoteDataObject(new PaginatedList(pageInfo, [childEntry3]))
|
a: createSuccessfulRemoteDataObject(new PaginatedList(pageInfo, [childEntry3]))
|
||||||
}));
|
}));
|
||||||
|
|
||||||
serviceAsAny.vocabularyService.findEntryDetailByValue.and.returnValue(hot('-a', {
|
serviceAsAny.vocabularyService.findEntryDetailById.and.returnValue(hot('-a', {
|
||||||
a: createSuccessfulRemoteDataObject(child3)
|
a: createSuccessfulRemoteDataObject(child3)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@@ -188,7 +188,7 @@ export class VocabularyTreeviewService {
|
|||||||
getFirstSucceededRemoteListPayload(),
|
getFirstSucceededRemoteListPayload(),
|
||||||
flatMap((result: VocabularyEntry[]) => (result.length > 0) ? result : observableOf(null)),
|
flatMap((result: VocabularyEntry[]) => (result.length > 0) ? result : observableOf(null)),
|
||||||
flatMap((entry: VocabularyEntry) =>
|
flatMap((entry: VocabularyEntry) =>
|
||||||
this.vocabularyService.findEntryDetailByValue(entry.otherInformation.id, this.vocabularyName).pipe(
|
this.vocabularyService.findEntryDetailById(entry.otherInformation.id, this.vocabularyName).pipe(
|
||||||
getFirstSucceededRemoteDataPayload()
|
getFirstSucceededRemoteDataPayload()
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
@@ -289,7 +289,7 @@ export class VocabularyTreeviewService {
|
|||||||
* @return Observable<VocabularyEntryDetail>
|
* @return Observable<VocabularyEntryDetail>
|
||||||
*/
|
*/
|
||||||
private getById(entryId: string): Observable<VocabularyEntryDetail> {
|
private getById(entryId: string): Observable<VocabularyEntryDetail> {
|
||||||
return this.vocabularyService.findEntryDetailByValue(entryId, this.vocabularyName).pipe(
|
return this.vocabularyService.findEntryDetailById(entryId, this.vocabularyName).pipe(
|
||||||
getFirstSucceededRemoteDataPayload()
|
getFirstSucceededRemoteDataPayload()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user