Changed findEntryDetailByValue method name to a properly findEntryDetailById

This commit is contained in:
Giuseppe Digilio
2020-07-22 17:49:36 +02:00
parent d88a863a0d
commit fb1b6c7a7a
5 changed files with 13 additions and 13 deletions

View File

@@ -481,16 +481,16 @@ describe('VocabularyService', () => {
});
});
describe('findEntryDetailByValue', () => {
describe('findEntryDetailById', () => {
it('should proxy the call to vocabularyDataService.findVocabularyById', () => {
scheduler.schedule(() => service.findEntryDetailByValue('testValue', hierarchicalVocabulary.id));
scheduler.schedule(() => service.findEntryDetailById('testValue', hierarchicalVocabulary.id));
scheduler.flush();
const expectedId = `${hierarchicalVocabulary.id}:testValue`
expect((service as any).vocabularyEntryDetailDataService.findById).toHaveBeenCalledWith(expectedId);
});
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|', {
a: vocabularyEntryDetailParentRD
});

View File

@@ -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},
* 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 linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
* @return {Observable<RemoteData<VocabularyEntryDetail>>}
* Return an observable that emits VocabularyEntryDetail object
*/
findEntryDetailByValue(value: string, name: string, ...linksToFollow: Array<FollowLinkConfig<VocabularyEntryDetail>>): Observable<RemoteData<VocabularyEntryDetail>> {
const id = `${name}:${value}`;
return this.vocabularyEntryDetailDataService.findById(id, ...linksToFollow);
findEntryDetailById(id: string, name: string, ...linksToFollow: Array<FollowLinkConfig<VocabularyEntryDetail>>): Observable<RemoteData<VocabularyEntryDetail>> {
const findId = `${name}:${id}`;
return this.vocabularyEntryDetailDataService.findById(findId, ...linksToFollow);
}
/**

View File

@@ -233,7 +233,7 @@ export class DsDynamicRelationGroupComponent extends DynamicFormControlComponent
if (isObject(valueObj[fieldName]) && valueObj[fieldName].hasAuthority() && isNotEmpty(valueObj[fieldName].authority)) {
const fieldId = fieldName.replace(/\./g, '_');
const model = this.formBuilderService.findById(fieldId, this.formModel);
return$ = this.vocabularyService.findEntryDetailByValue(
return$ = this.vocabularyService.findEntryDetailById(
valueObj[fieldName].authority,
(model as any).vocabularyOptions.name
).pipe(

View File

@@ -57,7 +57,7 @@ describe('VocabularyTreeviewService test suite', () => {
const vocabularyServiceStub = jasmine.createSpyObj('VocabularyService', {
getVocabularyEntriesByValue: jasmine.createSpy('getVocabularyEntriesByValue'),
getEntryDetailParent: jasmine.createSpy('getEntryDetailParent'),
findEntryDetailByValue: jasmine.createSpy('findEntryDetailByValue'),
findEntryDetailById: jasmine.createSpy('findEntryDetailById'),
searchTopEntries: jasmine.createSpy('searchTopEntries'),
getEntryDetailChildren: jasmine.createSpy('getEntryDetailChildren'),
clearSearchTopRequests: jasmine.createSpy('clearSearchTopRequests')
@@ -202,7 +202,7 @@ describe('VocabularyTreeviewService test suite', () => {
serviceAsAny.vocabularyService.searchTopEntries.and.returnValue(hot('-c', {
a: createSuccessfulRemoteDataObject(new PaginatedList(pageInfo, [item, item2, item3]))
}));
serviceAsAny.vocabularyService.findEntryDetailByValue.and.returnValue(
serviceAsAny.vocabularyService.findEntryDetailById.and.returnValue(
hot('-a', {
a: createSuccessfulRemoteDataObject(child2)
})
@@ -303,7 +303,7 @@ describe('VocabularyTreeviewService test suite', () => {
a: createSuccessfulRemoteDataObject(new PaginatedList(pageInfo, [childEntry3]))
}));
serviceAsAny.vocabularyService.findEntryDetailByValue.and.returnValue(hot('-a', {
serviceAsAny.vocabularyService.findEntryDetailById.and.returnValue(hot('-a', {
a: createSuccessfulRemoteDataObject(child3)
}));

View File

@@ -188,7 +188,7 @@ export class VocabularyTreeviewService {
getFirstSucceededRemoteListPayload(),
flatMap((result: VocabularyEntry[]) => (result.length > 0) ? result : observableOf(null)),
flatMap((entry: VocabularyEntry) =>
this.vocabularyService.findEntryDetailByValue(entry.otherInformation.id, this.vocabularyName).pipe(
this.vocabularyService.findEntryDetailById(entry.otherInformation.id, this.vocabularyName).pipe(
getFirstSucceededRemoteDataPayload()
)
),
@@ -289,7 +289,7 @@ export class VocabularyTreeviewService {
* @return 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()
);
}