mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-11 20:13:07 +00:00
fix self links in mocks
This commit is contained in:
@@ -115,13 +115,13 @@ describe('ObjectCacheService', () => {
|
|||||||
|
|
||||||
describe('getList', () => {
|
describe('getList', () => {
|
||||||
it('should return an observable of the array of cached objects with the specified self link and type', () => {
|
it('should return an observable of the array of cached objects with the specified self link and type', () => {
|
||||||
const item = new NormalizedItem();
|
const item = new Item();
|
||||||
item.self = selfLink;
|
item._links.self = { href: selfLink };
|
||||||
spyOn(service, 'getObjectBySelfLink').and.returnValue(observableOf(item));
|
spyOn(service, 'getObjectBySelfLink').and.returnValue(observableOf(item));
|
||||||
|
|
||||||
service.getList([selfLink, selfLink]).pipe(first()).subscribe((arr) => {
|
service.getList([selfLink, selfLink]).pipe(first()).subscribe((arr) => {
|
||||||
expect(arr[0].self).toBe(selfLink);
|
expect(arr[0].self).toBe(selfLink);
|
||||||
expect(arr[0] instanceof NormalizedItem).toBeTruthy();
|
expect(arr[0] instanceof Item).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -48,7 +48,7 @@ describe('ServerSyncBufferEffects', () => {
|
|||||||
provide: ObjectCacheService, useValue: {
|
provide: ObjectCacheService, useValue: {
|
||||||
getObjectBySelfLink: (link) => {
|
getObjectBySelfLink: (link) => {
|
||||||
const object = new DSpaceObject();
|
const object = new DSpaceObject();
|
||||||
object.self = link;
|
object._links.self = { href: link };
|
||||||
return observableOf(object);
|
return observableOf(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -185,11 +185,11 @@ describe('DataService', () => {
|
|||||||
selfLink = 'https://rest.api/endpoint/1698f1d3-be98-4c51-9fd8-6bfedcbd59b7';
|
selfLink = 'https://rest.api/endpoint/1698f1d3-be98-4c51-9fd8-6bfedcbd59b7';
|
||||||
|
|
||||||
dso = new DSpaceObject();
|
dso = new DSpaceObject();
|
||||||
dso.self = selfLink;
|
dso._links.self = { href: selfLink };
|
||||||
dso.metadata = [{ key: 'dc.title', value: name1 }];
|
dso.metadata = [{ key: 'dc.title', value: name1 }];
|
||||||
|
|
||||||
dso2 = new DSpaceObject();
|
dso2 = new DSpaceObject();
|
||||||
dso2.self = selfLink;
|
dso2._link.self = { href: selfLink };
|
||||||
dso2.metadata = [{ key: 'dc.title', value: name2 }];
|
dso2.metadata = [{ key: 'dc.title', value: name2 }];
|
||||||
|
|
||||||
spyOn(service, 'findByHref').and.returnValue(createSuccessfulRemoteDataObject$(dso));
|
spyOn(service, 'findByHref').and.returnValue(createSuccessfulRemoteDataObject$(dso));
|
||||||
|
@@ -9,7 +9,11 @@ export const EPersonMock: EPerson = Object.assign(new EPerson(),{
|
|||||||
email: 'test@test.com',
|
email: 'test@test.com',
|
||||||
requireCertificate: false,
|
requireCertificate: false,
|
||||||
selfRegistered: false,
|
selfRegistered: false,
|
||||||
self: 'https://dspace.4science.it/dspace-spring-rest/api/eperson/epersons/testid',
|
_links: {
|
||||||
|
self: {
|
||||||
|
href: 'https://dspace.4science.it/dspace-spring-rest/api/eperson/epersons/testid',
|
||||||
|
}
|
||||||
|
},
|
||||||
id: 'testid',
|
id: 'testid',
|
||||||
uuid: 'testid',
|
uuid: 'testid',
|
||||||
type: 'eperson',
|
type: 'eperson',
|
||||||
|
Reference in New Issue
Block a user