item-data.service.spec.ts (dspace-angular-dspace-7.0) | : | item-data.service.spec.ts (dspace-angular-dspace-7.1) | ||
---|---|---|---|---|
skipping to change at line 34 | skipping to change at line 34 | |||
generateRequestId(): string { | generateRequestId(): string { | |||
return scopeID; | return scopeID; | |||
}, | }, | |||
getByHref(requestHref: string) { | getByHref(requestHref: string) { | |||
const responseCacheEntry = new RequestEntry(); | const responseCacheEntry = new RequestEntry(); | |||
responseCacheEntry.response = new RestResponse(true, 200, 'OK'); | responseCacheEntry.response = new RestResponse(true, 200, 'OK'); | |||
return observableOf(responseCacheEntry); | return observableOf(responseCacheEntry); | |||
}, | }, | |||
removeByHrefSubstring(href: string) { | removeByHrefSubstring(href: string) { | |||
// Do nothing | // Do nothing | |||
} | }, | |||
}) as RequestService; | }) as RequestService; | |||
const rdbService = getMockRemoteDataBuildService(); | const rdbService = getMockRemoteDataBuildService(); | |||
const itemEndpoint = 'https://rest.api/core/items'; | const itemEndpoint = 'https://rest.api/core/items'; | |||
const store = {} as Store<CoreState>; | const store = {} as Store<CoreState>; | |||
const objectCache = {} as ObjectCacheService; | const objectCache = {} as ObjectCacheService; | |||
const halEndpointService = jasmine.createSpyObj('halService', { | const halEndpointService = jasmine.createSpyObj('halService', { | |||
getEndpoint: observableOf(itemEndpoint) | getEndpoint: observableOf(itemEndpoint) | |||
}); | }); | |||
skipping to change at line 187 | skipping to change at line 187 | |||
}); | }); | |||
it('should send a POST request', (done) => { | it('should send a POST request', (done) => { | |||
result.subscribe(() => { | result.subscribe(() => { | |||
expect(requestService.send).toHaveBeenCalledWith(jasmine.any(PostRequest )); | expect(requestService.send).toHaveBeenCalledWith(jasmine.any(PostRequest )); | |||
done(); | done(); | |||
}); | }); | |||
}); | }); | |||
}); | }); | |||
describe('when cache is invalidated', () => { | ||||
beforeEach(() => { | ||||
service = initTestService(); | ||||
}); | ||||
it('should call setStaleByHrefSubstring', () => { | ||||
service.invalidateItemCache('uuid'); | ||||
expect(requestService.setStaleByHrefSubstring).toHaveBeenCalledWith('item/ | ||||
uuid'); | ||||
}); | ||||
}); | ||||
}); | }); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 12 lines changed or added |