fix self links in mocks

This commit is contained in:
Art Lowel
2020-02-13 10:07:33 +01:00
parent 07998a8c08
commit e6c1069e19
4 changed files with 11 additions and 7 deletions

View File

@@ -115,13 +115,13 @@ describe('ObjectCacheService', () => {
describe('getList', () => {
it('should return an observable of the array of cached objects with the specified self link and type', () => {
const item = new NormalizedItem();
item.self = selfLink;
const item = new Item();
item._links.self = { href: selfLink };
spyOn(service, 'getObjectBySelfLink').and.returnValue(observableOf(item));
service.getList([selfLink, selfLink]).pipe(first()).subscribe((arr) => {
expect(arr[0].self).toBe(selfLink);
expect(arr[0] instanceof NormalizedItem).toBeTruthy();
expect(arr[0] instanceof Item).toBeTruthy();
});
});
});

View File

@@ -48,7 +48,7 @@ describe('ServerSyncBufferEffects', () => {
provide: ObjectCacheService, useValue: {
getObjectBySelfLink: (link) => {
const object = new DSpaceObject();
object.self = link;
object._links.self = { href: link };
return observableOf(object);
}
}

View File

@@ -185,11 +185,11 @@ describe('DataService', () => {
selfLink = 'https://rest.api/endpoint/1698f1d3-be98-4c51-9fd8-6bfedcbd59b7';
dso = new DSpaceObject();
dso.self = selfLink;
dso._links.self = { href: selfLink };
dso.metadata = [{ key: 'dc.title', value: name1 }];
dso2 = new DSpaceObject();
dso2.self = selfLink;
dso2._link.self = { href: selfLink };
dso2.metadata = [{ key: 'dc.title', value: name2 }];
spyOn(service, 'findByHref').and.returnValue(createSuccessfulRemoteDataObject$(dso));

View File

@@ -9,7 +9,11 @@ export const EPersonMock: EPerson = Object.assign(new EPerson(),{
email: 'test@test.com',
requireCertificate: 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',
uuid: 'testid',
type: 'eperson',