From 7982259774760abe83a71c22219d69848dfee884 Mon Sep 17 00:00:00 2001 From: Koen Pauwels Date: Tue, 3 Jan 2023 15:08:55 +0100 Subject: [PATCH] 97257 Processing review feedback --- .../editable-item-selector.component.html | 1 - .../editable-item-selector.component.spec.ts | 31 +++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) delete mode 100644 src/app/shared/dso-selector/dso-selector/editable-item-selector/editable-item-selector.component.html diff --git a/src/app/shared/dso-selector/dso-selector/editable-item-selector/editable-item-selector.component.html b/src/app/shared/dso-selector/dso-selector/editable-item-selector/editable-item-selector.component.html deleted file mode 100644 index 3c0e265c6d3..00000000000 --- a/src/app/shared/dso-selector/dso-selector/editable-item-selector/editable-item-selector.component.html +++ /dev/null @@ -1 +0,0 @@ -

editable-item-selector works!

diff --git a/src/app/shared/dso-selector/dso-selector/editable-item-selector/editable-item-selector.component.spec.ts b/src/app/shared/dso-selector/dso-selector/editable-item-selector/editable-item-selector.component.spec.ts index 518ed548e90..709d9b76685 100644 --- a/src/app/shared/dso-selector/dso-selector/editable-item-selector/editable-item-selector.component.spec.ts +++ b/src/app/shared/dso-selector/dso-selector/editable-item-selector/editable-item-selector.component.spec.ts @@ -41,18 +41,31 @@ describe('EditableItemSelectorComponent', () => { ['1','2','3'].map(createFindItemsResult), ['4','5','6'].map(createFindItemsResult), ]; - const itemDataService = { - findItemsWithEdit: (query: string, options: FindListOptions, - useCachedVersionIfAvailable = true, reRequestOnStale = true) => { - return createSuccessfulRemoteDataObject$(createPaginatedList( - query.startsWith('search.resourceid') ? [currentResult] : pages[options.currentPage - 1] - )); - } - }; + +/* + beforeEach(() => { + dsoService = { + findByIdAndIDType: jasmine.createSpy('findByIdAndIDType').and.returnValue(observableOf({ hasFailed: false, + hasSucceeded: true })) + }; + guard = new LookupGuard(dsoService); + }); + */ + let itemDataService; let notificationsService: NotificationsService; beforeEach(waitForAsync( () => { notificationsService = jasmine.createSpyObj('notificationsService', ['error']); + itemDataService = { + findItemsWithEdit: jasmine.createSpy('findItemsWithEdit').and.callFake( + (query: string, options: FindListOptions, + useCachedVersionIfAvailable = true, reRequestOnStale = true) => { + return createSuccessfulRemoteDataObject$(createPaginatedList( + query.startsWith('search.resourceid') ? [currentResult] : pages[options.currentPage - 1] + )); + } + ) + }; TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], declarations: [EditableItemSelectorComponent], @@ -109,7 +122,7 @@ describe('EditableItemSelectorComponent', () => { describe('when search returns an error', () => { beforeEach(() => { - spyOn(itemDataService, 'findItemsWithEdit').and.returnValue(createFailedRemoteDataObject$()); + itemDataService.findItemsWithEdit.and.returnValue(createFailedRemoteDataObject$()); component.ngOnInit(); });