mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
refactor all remaining self links in mocks
This commit is contained in:
@@ -26,13 +26,21 @@ describe('MetadataRegistryComponent', () => {
|
||||
const mockSchemasList = [
|
||||
{
|
||||
id: 1,
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/1',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/1'
|
||||
},
|
||||
},
|
||||
prefix: 'dc',
|
||||
namespace: 'http://dublincore.org/documents/dcmi-terms/'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/2',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/2'
|
||||
},
|
||||
},
|
||||
prefix: 'mock',
|
||||
namespace: 'http://dspace.org/mockschema'
|
||||
}
|
||||
|
@@ -20,7 +20,11 @@ class NullAction extends MetadataRegistryEditSchemaAction {
|
||||
const schema: MetadataSchema = Object.assign(new MetadataSchema(),
|
||||
{
|
||||
id: 'schema-id',
|
||||
self: 'http://rest.self/schema/dc',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'http://rest.self/schema/dc'
|
||||
},
|
||||
},
|
||||
prefix: 'dc',
|
||||
namespace: 'http://dublincore.org/documents/dcmi-terms/'
|
||||
});
|
||||
@@ -28,7 +32,11 @@ const schema: MetadataSchema = Object.assign(new MetadataSchema(),
|
||||
const schema2: MetadataSchema = Object.assign(new MetadataSchema(),
|
||||
{
|
||||
id: 'another-schema-id',
|
||||
self: 'http://rest.self/schema/dcterms',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'http://rest.self/schema/dcterms',
|
||||
},
|
||||
},
|
||||
prefix: 'dcterms',
|
||||
namespace: 'http://purl.org/dc/terms/'
|
||||
});
|
||||
@@ -36,7 +44,11 @@ const schema2: MetadataSchema = Object.assign(new MetadataSchema(),
|
||||
const field: MetadataField = Object.assign(new MetadataField(),
|
||||
{
|
||||
id: 'author-field-id',
|
||||
self: 'http://rest.self/field/author',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'http://rest.self/field/author',
|
||||
},
|
||||
},
|
||||
element: 'contributor',
|
||||
qualifier: 'author',
|
||||
scopeNote: 'Author of an item',
|
||||
@@ -46,7 +58,11 @@ const field: MetadataField = Object.assign(new MetadataField(),
|
||||
const field2: MetadataField = Object.assign(new MetadataField(),
|
||||
{
|
||||
id: 'title-field-id',
|
||||
self: 'http://rest.self/field/title',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'http://rest.self/field/title',
|
||||
},
|
||||
},
|
||||
element: 'title',
|
||||
qualifier: null,
|
||||
scopeNote: 'Title of an item',
|
||||
|
@@ -30,13 +30,21 @@ describe('MetadataSchemaComponent', () => {
|
||||
const mockSchemasList = [
|
||||
{
|
||||
id: 1,
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/1',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/1',
|
||||
},
|
||||
},
|
||||
prefix: 'dc',
|
||||
namespace: 'http://dublincore.org/documents/dcmi-terms/'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/2',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/2',
|
||||
},
|
||||
},
|
||||
prefix: 'mock',
|
||||
namespace: 'http://dspace.org/mockschema'
|
||||
}
|
||||
@@ -44,7 +52,11 @@ describe('MetadataSchemaComponent', () => {
|
||||
const mockFieldsList = [
|
||||
{
|
||||
id: 1,
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/8',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/8',
|
||||
},
|
||||
},
|
||||
element: 'contributor',
|
||||
qualifier: 'advisor',
|
||||
scopeNote: null,
|
||||
@@ -52,7 +64,11 @@ describe('MetadataSchemaComponent', () => {
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/9',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/9',
|
||||
},
|
||||
},
|
||||
element: 'contributor',
|
||||
qualifier: 'author',
|
||||
scopeNote: null,
|
||||
@@ -60,7 +76,11 @@ describe('MetadataSchemaComponent', () => {
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/10',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/10',
|
||||
},
|
||||
},
|
||||
element: 'contributor',
|
||||
qualifier: 'editor',
|
||||
scopeNote: 'test scope note',
|
||||
@@ -68,7 +88,11 @@ describe('MetadataSchemaComponent', () => {
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/11',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadatafields/11',
|
||||
},
|
||||
},
|
||||
element: 'contributor',
|
||||
qualifier: 'illustrator',
|
||||
scopeNote: null,
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import { filter, tap } from 'rxjs/operators';
|
||||
import { CollectionItemMapperComponent } from './collection-item-mapper.component';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
@@ -52,7 +53,12 @@ describe('CollectionItemMapperComponent', () => {
|
||||
|
||||
const mockCollection: Collection = Object.assign(new Collection(), {
|
||||
id: 'ce41d451-97ed-4a9c-94a1-7de34f16a9f4',
|
||||
name: 'test-collection'
|
||||
name: 'test-collection',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://rest.api/collections/ce41d451-97ed-4a9c-94a1-7de34f16a9f4'
|
||||
}
|
||||
}
|
||||
});
|
||||
const mockCollectionRD: RemoteData<Collection> = new RemoteData<Collection>(false, false, true, null, mockCollection);
|
||||
const mockSearchOptions = of(new PaginatedSearchOptions({
|
||||
|
@@ -155,7 +155,7 @@ export class CollectionItemMapperComponent implements OnInit {
|
||||
map((collectionRD: RemoteData<Collection>) => collectionRD.payload),
|
||||
switchMap((collection: Collection) =>
|
||||
observableCombineLatest(ids.map((id: string) =>
|
||||
remove ? this.itemDataService.removeMappingFromCollection(id, collection.id) : this.itemDataService.mapToCollection(id, collection.self)
|
||||
remove ? this.itemDataService.removeMappingFromCollection(id, collection.id) : this.itemDataService.mapToCollection(id, collection._links.self.href)
|
||||
))
|
||||
)
|
||||
);
|
||||
|
@@ -169,7 +169,11 @@ describe('ConfigResponseParsingService', () => {
|
||||
totalElements: 4,
|
||||
totalPages: 1,
|
||||
currentPage: 1,
|
||||
self: 'https://rest.api/config/submissiondefinitions/traditional/sections'
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://rest.api/config/submissiondefinitions/traditional/sections'
|
||||
},
|
||||
},
|
||||
});
|
||||
const definitions =
|
||||
Object.assign(new SubmissionDefinitionModel(), {
|
||||
@@ -180,7 +184,6 @@ describe('ConfigResponseParsingService', () => {
|
||||
sections: { href: 'https://rest.api/config/submissiondefinitions/traditional/sections' },
|
||||
self: { href: 'https://rest.api/config/submissiondefinitions/traditional' }
|
||||
},
|
||||
self: 'https://rest.api/config/submissiondefinitions/traditional',
|
||||
sections: new PaginatedList(pageinfo, [
|
||||
Object.assign(new SubmissionSectionModel(), {
|
||||
header: 'submit.progressbar.describe.stepone',
|
||||
@@ -195,7 +198,6 @@ describe('ConfigResponseParsingService', () => {
|
||||
self: { href: 'https://rest.api/config/submissionsections/traditionalpageone' },
|
||||
config: { href: 'https://rest.api/config/submissionforms/traditionalpageone' }
|
||||
},
|
||||
self: 'https://rest.api/config/submissionsections/traditionalpageone',
|
||||
}),
|
||||
Object.assign(new SubmissionSectionModel(), {
|
||||
header: 'submit.progressbar.describe.steptwo',
|
||||
@@ -210,7 +212,6 @@ describe('ConfigResponseParsingService', () => {
|
||||
self: { href: 'https://rest.api/config/submissionsections/traditionalpagetwo' },
|
||||
config: { href: 'https://rest.api/config/submissionforms/traditionalpagetwo' }
|
||||
},
|
||||
self: 'https://rest.api/config/submissionsections/traditionalpagetwo',
|
||||
}),
|
||||
Object.assign(new SubmissionSectionModel(), {
|
||||
header: 'submit.progressbar.upload',
|
||||
@@ -225,7 +226,6 @@ describe('ConfigResponseParsingService', () => {
|
||||
self: { href: 'https://rest.api/config/submissionsections/upload' },
|
||||
config: { href: 'https://rest.api/config/submissionuploads/upload' }
|
||||
},
|
||||
self: 'https://rest.api/config/submissionsections/upload',
|
||||
}),
|
||||
Object.assign(new SubmissionSectionModel(), {
|
||||
header: 'submit.progressbar.license',
|
||||
@@ -239,7 +239,6 @@ describe('ConfigResponseParsingService', () => {
|
||||
_links: {
|
||||
self: { href: 'https://rest.api/config/submissionsections/license' }
|
||||
},
|
||||
self: 'https://rest.api/config/submissionsections/license',
|
||||
})
|
||||
])
|
||||
});
|
||||
|
@@ -42,10 +42,6 @@ export class SearchResponseParsingService implements ResponseParsingService {
|
||||
const dsoSelfLinks = payload._embedded.objects
|
||||
.filter((object) => hasValue(object._embedded))
|
||||
.map((object) => object._embedded.indexableObject)
|
||||
// we don't need embedded collections, bitstreamformats, etc for search results.
|
||||
// And parsing them all takes up a lot of time. Throw them away to improve performance
|
||||
// until objs until partial results are supported by the rest api
|
||||
.map((dso) => Object.assign({}, dso, { _embedded: undefined }))
|
||||
.map((dso) => this.dsoParser.parse(request, {
|
||||
payload: dso,
|
||||
statusCode: data.statusCode,
|
||||
|
@@ -52,12 +52,22 @@ export class DSpaceObject extends ListableObject implements CacheableObject {
|
||||
type: ResourceType;
|
||||
|
||||
/**
|
||||
* A shorthand for this DSpaceObject's self link
|
||||
* A shorthand to get this DSpaceObject's self link
|
||||
*/
|
||||
get self(): string {
|
||||
return this._links.self.href;
|
||||
}
|
||||
|
||||
/**
|
||||
* A shorthand to set this DSpaceObject's self link
|
||||
*/
|
||||
set self(v: string) {
|
||||
debugger;
|
||||
this._links.self = {
|
||||
href: v
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The name for this DSpaceObject
|
||||
*/
|
||||
|
@@ -373,10 +373,14 @@ describe('FormBuilderService test suite', () => {
|
||||
]
|
||||
} as FormRowModel
|
||||
],
|
||||
self: 'testFormConfiguration.url',
|
||||
self: {
|
||||
href: 'testFormConfiguration.url'
|
||||
},
|
||||
type: 'submissionform',
|
||||
_links: {
|
||||
self: 'testFormConfiguration.url'
|
||||
self: {
|
||||
href: 'testFormConfiguration.url'
|
||||
}
|
||||
}
|
||||
} as any;
|
||||
});
|
||||
|
@@ -12,7 +12,11 @@ export const MockBitstreamFormat1: BitstreamFormat = Object.assign(new Bitstream
|
||||
supportLevel: 0,
|
||||
internal: false,
|
||||
extensions: null,
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreamformats/10'
|
||||
_links:{
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreamformats/10'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export const MockBitstreamFormat2: BitstreamFormat = Object.assign(new BitstreamFormat(), {
|
||||
@@ -22,7 +26,11 @@ export const MockBitstreamFormat2: BitstreamFormat = Object.assign(new Bitstream
|
||||
supportLevel: 0,
|
||||
internal: false,
|
||||
extensions: null,
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreamformats/4'
|
||||
_links:{
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreamformats/4'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export const MockBitstream1: Bitstream = Object.assign(new Bitstream(),
|
||||
@@ -31,7 +39,11 @@ export const MockBitstream1: Bitstream = Object.assign(new Bitstream(),
|
||||
content: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713/content',
|
||||
format: observableOf(MockBitstreamFormat1),
|
||||
bundleName: 'ORIGINAL',
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713',
|
||||
_links:{
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713'
|
||||
}
|
||||
},
|
||||
id: 'cf9b0c8e-a1eb-4b65-afd0-567366448713',
|
||||
uuid: 'cf9b0c8e-a1eb-4b65-afd0-567366448713',
|
||||
type: 'bitstream',
|
||||
@@ -50,7 +62,6 @@ export const MockBitstream2: Bitstream = Object.assign(new Bitstream(), {
|
||||
content: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/99b00f3c-1cc6-4689-8158-91965bee6b28/content',
|
||||
format: observableOf(MockBitstreamFormat2),
|
||||
bundleName: 'ORIGINAL',
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/99b00f3c-1cc6-4689-8158-91965bee6b28',
|
||||
id: '99b00f3c-1cc6-4689-8158-91965bee6b28',
|
||||
uuid: '99b00f3c-1cc6-4689-8158-91965bee6b28',
|
||||
type: 'bitstream',
|
||||
@@ -81,7 +92,11 @@ export const MockItem: Item = Object.assign(new Item(), {
|
||||
{
|
||||
name: 'ORIGINAL',
|
||||
bitstreams: observableOf(Object.assign({
|
||||
self: 'dspace-angular://aggregated/object/1507836003548',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'dspace-angular://aggregated/object/1507836003548',
|
||||
}
|
||||
},
|
||||
requestPending: false,
|
||||
responsePending: false,
|
||||
isSuccessful: true,
|
||||
@@ -110,7 +125,11 @@ export const MockItem: Item = Object.assign(new Item(), {
|
||||
}))
|
||||
}
|
||||
])),
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/items/0ec7ff22-f211-40ab-a69e-c819b0b1f357',
|
||||
_links:{
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/items/0ec7ff22-f211-40ab-a69e-c819b0b1f357'
|
||||
}
|
||||
},
|
||||
id: '0ec7ff22-f211-40ab-a69e-c819b0b1f357',
|
||||
uuid: '0ec7ff22-f211-40ab-a69e-c819b0b1f357',
|
||||
type: 'item',
|
||||
@@ -215,7 +234,11 @@ export const MockItem: Item = Object.assign(new Item(), {
|
||||
]
|
||||
},
|
||||
owningCollection: observableOf({
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb'
|
||||
}
|
||||
},
|
||||
requestPending: false,
|
||||
responsePending: false,
|
||||
isSuccessful: true,
|
||||
|
@@ -124,7 +124,11 @@ export const objects: DSpaceObject[] = [
|
||||
scheduler: null
|
||||
}
|
||||
},
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/communities/7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/communities/7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
||||
},
|
||||
},
|
||||
id: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
||||
uuid: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
||||
type: Community.type,
|
||||
@@ -178,7 +182,11 @@ export const objects: DSpaceObject[] = [
|
||||
scheduler: null
|
||||
}
|
||||
},
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/communities/9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/communities/9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||
},
|
||||
},
|
||||
id: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||
uuid: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||
type: Community.type,
|
||||
|
@@ -111,7 +111,11 @@ export const objects = [
|
||||
scheduler: null
|
||||
}
|
||||
},
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/communities/7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/communities/7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
||||
},
|
||||
},
|
||||
id: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
||||
uuid: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
||||
type: Community.type,
|
||||
@@ -165,7 +169,11 @@ export const objects = [
|
||||
scheduler: null
|
||||
}
|
||||
},
|
||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/communities/9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/communities/9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||
},
|
||||
},
|
||||
id: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||
uuid: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||
type: Community.type,
|
||||
|
@@ -108,10 +108,11 @@ const testFormConfiguration = {
|
||||
]
|
||||
} as FormRowModel,
|
||||
],
|
||||
self: 'testFormConfiguration.url',
|
||||
type: 'submissionform',
|
||||
_links: {
|
||||
self: 'testFormConfiguration.url'
|
||||
self: {
|
||||
href: 'testFormConfiguration.url'
|
||||
}
|
||||
}
|
||||
} as any;
|
||||
|
||||
|
Reference in New Issue
Block a user