fix issue where a bunch of unnecessary requests where made when creating or removing a metadata field

This commit is contained in:
Art Lowel
2021-01-27 17:20:38 +01:00
parent 17e8881380
commit 0f5c3fdc92
6 changed files with 19 additions and 20 deletions

View File

@@ -33,7 +33,7 @@ describe('MetadataFieldDataService', () => {
generateRequestId: '34cfed7c-f597-49ef-9cbe-ea351f0023c2',
send: {},
getByUUID: observableOf({ response: new RestResponse(true, 200, 'OK') }),
removeByHrefSubstring: {}
setStaleByHrefSubstring: {}
});
halService = Object.assign(new HALEndpointServiceStub(endpoint));
notificationsService = jasmine.createSpyObj('notificationsService', {
@@ -64,11 +64,10 @@ describe('MetadataFieldDataService', () => {
});
describe('clearRequests', () => {
it('should remove requests on the data service\'s endpoint', (done) => {
metadataFieldService.clearRequests().subscribe(() => {
expect(requestService.removeByHrefSubstring).toHaveBeenCalledWith(`${endpoint}/${(metadataFieldService as any).linkPath}`);
done();
});
it('should remove requests on the data service\'s endpoint', () => {
spyOn(metadataFieldService, 'getBrowseEndpoint').and.returnValue(observableOf(endpoint));
metadataFieldService.clearRequests();
expect(requestService.setStaleByHrefSubstring).toHaveBeenCalledWith(endpoint);
});
});
});