diff --git a/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts b/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts index 02a2eaf04f6..2966ed90005 100644 --- a/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts +++ b/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts @@ -165,7 +165,7 @@ describe('EPeopleRegistryComponent', () => { { provide: AuthorizationDataService, useValue: authorizationService }, { provide: FormBuilderService, useValue: builderService }, { provide: Router, useValue: new RouterMock() }, - { provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) }, + { provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['setStaleByHrefSubstring']) }, { provide: PaginationService, useValue: paginationService }, ], schemas: [NO_ERRORS_SCHEMA], diff --git a/src/app/core/eperson/eperson-data.service.spec.ts b/src/app/core/eperson/eperson-data.service.spec.ts index fa91811d27c..9ed2c1267d7 100644 --- a/src/app/core/eperson/eperson-data.service.spec.ts +++ b/src/app/core/eperson/eperson-data.service.spec.ts @@ -1,8 +1,6 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { - fakeAsync, TestBed, - tick, waitForAsync, } from '@angular/core/testing'; import { Store } from '@ngrx/store'; @@ -311,12 +309,12 @@ describe('EPersonDataService', () => { return of(`${restEndpointURL}/${linkPath}`); }); }); - it('should remove the eperson hrefs in the request service', fakeAsync(() => { - service.clearEPersonRequests(); - tick(); - - expect(requestService.removeByHrefSubstring).toHaveBeenCalledWith(epersonsEndpoint); - })); + it('should remove the eperson hrefs in the request service', (done) => { + service.clearEPersonRequests().subscribe(() => { + expect(requestService.setStaleByHrefSubstring).toHaveBeenCalledWith(epersonsEndpoint); + done(); + }); + }); }); describe('deleteEPerson', () => { diff --git a/src/app/core/eperson/eperson-data.service.ts b/src/app/core/eperson/eperson-data.service.ts index bdaad104750..3bee1576946 100644 --- a/src/app/core/eperson/eperson-data.service.ts +++ b/src/app/core/eperson/eperson-data.service.ts @@ -10,6 +10,7 @@ import { find, map, take, + tap, } from 'rxjs/operators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; @@ -277,10 +278,10 @@ export class EPersonDataService extends IdentifiableDataService impleme /** * Method that clears a cached EPerson request */ - public clearEPersonRequests(): void { - this.getBrowseEndpoint().pipe(take(1)).subscribe((link: string) => { - this.requestService.removeByHrefSubstring(link); - }); + public clearEPersonRequests(): Observable { + return this.getBrowseEndpoint().pipe( + tap((href: string) => this.requestService.setStaleByHrefSubstring(href)), + ); } /**