diff --git a/src/app/core/data/request.service.spec.ts b/src/app/core/data/request.service.spec.ts index 17d4a89d05b..6dff7746e90 100644 --- a/src/app/core/data/request.service.spec.ts +++ b/src/app/core/data/request.service.spec.ts @@ -436,9 +436,18 @@ describe('RequestService', () => { }); describe('when the request is added to the store', () => { + beforeEach(() => { + spyOn(service, 'getByHref').and.returnValue(Observable.of({ + request, + requestPending: false, + responsePending: true, + completed: false + })); + }); + it('should stop tracking the request', () => { - (store.select as any).and.returnValues(Observable.of({ request })); serviceAsAny.trackRequestsOnTheirWayToTheStore(request); + expect(service.getByHref).toHaveBeenCalledWith(request.href); expect(serviceAsAny.requestsOnTheirWayToTheStore.includes(request.href)).toBeFalsy(); }); }); diff --git a/src/app/core/data/request.service.ts b/src/app/core/data/request.service.ts index f589221e63c..2420e6bef0f 100644 --- a/src/app/core/data/request.service.ts +++ b/src/app/core/data/request.service.ts @@ -118,7 +118,7 @@ export class RequestService { */ private trackRequestsOnTheirWayToTheStore(request: GetRequest) { this.requestsOnTheirWayToTheStore = [...this.requestsOnTheirWayToTheStore, request.href]; - this.store.select(this.entryFromUUIDSelector(request.href)) + this.getByHref(request.href) .filter((re: RequestEntry) => hasValue(re)) .take(1) .subscribe((re: RequestEntry) => {