mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-09 11:03:05 +00:00
DS-4107 Update tests and mocks for metadata as map
This commit is contained in:
@@ -18,42 +18,38 @@ describe('SubCommunityList Component', () => {
|
|||||||
|
|
||||||
const subcommunities = [Object.assign(new Community(), {
|
const subcommunities = [Object.assign(new Community(), {
|
||||||
id: '123456789-1',
|
id: '123456789-1',
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{ language: 'en_US', value: 'SubCommunity 1' }
|
||||||
language: 'en_US',
|
]
|
||||||
value: 'SubCommunity 1'
|
}
|
||||||
}]
|
|
||||||
}),
|
}),
|
||||||
Object.assign(new Community(), {
|
Object.assign(new Community(), {
|
||||||
id: '123456789-2',
|
id: '123456789-2',
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{ language: 'en_US', value: 'SubCommunity 2' }
|
||||||
language: 'en_US',
|
]
|
||||||
value: 'SubCommunity 2'
|
}
|
||||||
}]
|
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
const emptySubCommunitiesCommunity = Object.assign(new Community(), {
|
const emptySubCommunitiesCommunity = Object.assign(new Community(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{ language: 'en_US', value: 'Test title' }
|
||||||
language: 'en_US',
|
]
|
||||||
value: 'Test title'
|
},
|
||||||
}],
|
|
||||||
subcommunities: observableOf(new RemoteData(true, true, true,
|
subcommunities: observableOf(new RemoteData(true, true, true,
|
||||||
undefined, new PaginatedList(new PageInfo(), [])))
|
undefined, new PaginatedList(new PageInfo(), [])))
|
||||||
});
|
});
|
||||||
|
|
||||||
const mockCommunity = Object.assign(new Community(), {
|
const mockCommunity = Object.assign(new Community(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{ language: 'en_US', value: 'Test title' }
|
||||||
language: 'en_US',
|
]
|
||||||
value: 'Test title'
|
},
|
||||||
}],
|
|
||||||
subcommunities: observableOf(new RemoteData(true, true, true,
|
subcommunities: observableOf(new RemoteData(true, true, true,
|
||||||
undefined, new PaginatedList(new PageInfo(), subcommunities)))
|
undefined, new PaginatedList(new PageInfo(), subcommunities)))
|
||||||
})
|
})
|
||||||
|
@@ -11,10 +11,14 @@ const mockItem = Object.assign(new Item(), {
|
|||||||
id: 'fake-id',
|
id: 'fake-id',
|
||||||
handle: 'fake/handle',
|
handle: 'fake/handle',
|
||||||
lastModified: '2018',
|
lastModified: '2018',
|
||||||
metadata: [
|
metadata: {
|
||||||
{key: 'dc.title', value: 'Mock item title', language: 'en'},
|
'dc.title': [
|
||||||
{key: 'dc.contributor.author', value: 'Mayer, Ed', language: ''}
|
{ value: 'Mock item title', language: 'en' }
|
||||||
]
|
],
|
||||||
|
'dc.contributor.author': [
|
||||||
|
{ value: 'Mayer, Ed', language: '' }
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('ModifyItemOverviewComponent', () => {
|
describe('ModifyItemOverviewComponent', () => {
|
||||||
@@ -37,19 +41,19 @@ describe('ModifyItemOverviewComponent', () => {
|
|||||||
const metadataRows = fixture.debugElement.queryAll(By.css('tr.metadata-row'));
|
const metadataRows = fixture.debugElement.queryAll(By.css('tr.metadata-row'));
|
||||||
expect(metadataRows.length).toEqual(2);
|
expect(metadataRows.length).toEqual(2);
|
||||||
|
|
||||||
const titleRow = metadataRows[0].queryAll(By.css('td'));
|
const authorRow = metadataRows[0].queryAll(By.css('td'));
|
||||||
expect(titleRow.length).toEqual(3);
|
|
||||||
|
|
||||||
expect(titleRow[0].nativeElement.innerHTML).toContain('dc.title');
|
|
||||||
expect(titleRow[1].nativeElement.innerHTML).toContain('Mock item title');
|
|
||||||
expect(titleRow[2].nativeElement.innerHTML).toContain('en');
|
|
||||||
|
|
||||||
const authorRow = metadataRows[1].queryAll(By.css('td'));
|
|
||||||
expect(authorRow.length).toEqual(3);
|
expect(authorRow.length).toEqual(3);
|
||||||
|
|
||||||
expect(authorRow[0].nativeElement.innerHTML).toContain('dc.contributor.author');
|
expect(authorRow[0].nativeElement.innerHTML).toContain('dc.contributor.author');
|
||||||
expect(authorRow[1].nativeElement.innerHTML).toContain('Mayer, Ed');
|
expect(authorRow[1].nativeElement.innerHTML).toContain('Mayer, Ed');
|
||||||
expect(authorRow[2].nativeElement.innerHTML).toEqual('');
|
expect(authorRow[2].nativeElement.innerHTML).toEqual('');
|
||||||
|
|
||||||
|
const titleRow = metadataRows[1].queryAll(By.css('td'));
|
||||||
|
expect(titleRow.length).toEqual(3);
|
||||||
|
|
||||||
|
expect(titleRow[0].nativeElement.innerHTML).toContain('dc.title');
|
||||||
|
expect(titleRow[1].nativeElement.innerHTML).toContain('Mock item title');
|
||||||
|
expect(titleRow[2].nativeElement.innerHTML).toContain('en');
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -14,12 +14,14 @@ let collectionsComponent: CollectionsComponent;
|
|||||||
let fixture: ComponentFixture<CollectionsComponent>;
|
let fixture: ComponentFixture<CollectionsComponent>;
|
||||||
|
|
||||||
const mockCollection1: Collection = Object.assign(new Collection(), {
|
const mockCollection1: Collection = Object.assign(new Collection(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.description.abstract': [
|
||||||
key: 'dc.description.abstract',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Short description'
|
value: 'Short description'
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const succeededMockItem: Item = Object.assign(new Item(), {owningCollection: observableOf(new RemoteData(false, false, true, null, mockCollection1))});
|
const succeededMockItem: Item = Object.assign(new Item(), {owningCollection: observableOf(new RemoteData(false, false, true, null, mockCollection1))});
|
||||||
|
@@ -111,33 +111,38 @@ export const objects = [
|
|||||||
id: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
id: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
||||||
uuid: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
uuid: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
||||||
type: ResourceType.Community,
|
type: ResourceType.Community,
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.description': [
|
||||||
key: 'dc.description',
|
{
|
||||||
language: null,
|
language: null,
|
||||||
value: ''
|
value: ''
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
key: 'dc.description.abstract',
|
'dc.description.abstract': [
|
||||||
language: null,
|
{
|
||||||
value: 'This is a test community to hold content for the OR2017 demostration'
|
language: null,
|
||||||
},
|
value: 'This is a test community to hold content for the OR2017 demostration'
|
||||||
{
|
}
|
||||||
key: 'dc.description.tableofcontents',
|
],
|
||||||
language: null,
|
'dc.description.tableofcontents': [
|
||||||
value: ''
|
{
|
||||||
},
|
language: null,
|
||||||
{
|
value: ''
|
||||||
key: 'dc.rights',
|
}
|
||||||
language: null,
|
],
|
||||||
value: ''
|
'dc.rights': [
|
||||||
},
|
{
|
||||||
{
|
language: null,
|
||||||
key: 'dc.title',
|
value: ''
|
||||||
language: null,
|
}
|
||||||
value: 'OR2017 - Demonstration'
|
],
|
||||||
}
|
'dc.title': [
|
||||||
]
|
{
|
||||||
|
language: null,
|
||||||
|
value: 'OR2017 - Demonstration'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
Object.assign(new Community(),
|
Object.assign(new Community(),
|
||||||
{
|
{
|
||||||
@@ -160,33 +165,38 @@ export const objects = [
|
|||||||
id: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
id: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||||
uuid: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
uuid: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||||
type: ResourceType.Community,
|
type: ResourceType.Community,
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.description': [
|
||||||
key: 'dc.description',
|
{
|
||||||
language: null,
|
language: null,
|
||||||
value: '<p>This is the introductory text for the <em>Sample Community</em> on the DSpace Demonstration Site. It is editable by System or Community Administrators (of this Community).</p>\r\n<p><strong>DSpace Communities may contain one or more Sub-Communities or Collections (of Items).</strong></p>\r\n<p>This particular Community has its own logo (the <a href=\'http://www.duraspace.org/\'>DuraSpace</a> logo).</p>'
|
value: '<p>This is the introductory text for the <em>Sample Community</em> on the DSpace Demonstration Site. It is editable by System or Community Administrators (of this Community).</p>\r\n<p><strong>DSpace Communities may contain one or more Sub-Communities or Collections (of Items).</strong></p>\r\n<p>This particular Community has its own logo (the <a href=\'http://www.duraspace.org/\'>DuraSpace</a> logo).</p>'
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
key: 'dc.description.abstract',
|
'dc.description.abstract': [
|
||||||
language: null,
|
{
|
||||||
value: 'This is a sample top-level community'
|
language: null,
|
||||||
},
|
value: 'This is a sample top-level community'
|
||||||
{
|
}
|
||||||
key: 'dc.description.tableofcontents',
|
],
|
||||||
language: null,
|
'dc.description.tableofcontents': [
|
||||||
value: '<p>This is the <em>news section</em> for this <em>Sample Community</em>. System or Community Administrators (of this Community) can edit this News field.</p>'
|
{
|
||||||
},
|
language: null,
|
||||||
{
|
value: '<p>This is the <em>news section</em> for this <em>Sample Community</em>. System or Community Administrators (of this Community) can edit this News field.</p>'
|
||||||
key: 'dc.rights',
|
}
|
||||||
language: null,
|
],
|
||||||
value: '<p><em>If this Community had special copyright text to display, it would be displayed here.</em></p>'
|
'dc.rights': [
|
||||||
},
|
{
|
||||||
{
|
language: null,
|
||||||
key: 'dc.title',
|
value: '<p><em>If this Community had special copyright text to display, it would be displayed here.</em></p>'
|
||||||
language: null,
|
}
|
||||||
value: 'Sample Community'
|
],
|
||||||
}
|
'dc.title': [
|
||||||
]
|
{
|
||||||
|
language: null,
|
||||||
|
value: 'Sample Community'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
|
@@ -60,23 +60,26 @@ describe('AuthResponseParsingService', () => {
|
|||||||
handle: null,
|
handle: null,
|
||||||
id: '4dc70ab5-cd73-492f-b007-3179d2d9296b',
|
id: '4dc70ab5-cd73-492f-b007-3179d2d9296b',
|
||||||
lastActive: '2018-05-14T17:03:31.277+0000',
|
lastActive: '2018-05-14T17:03:31.277+0000',
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'eperson.firstname': [
|
||||||
key: 'eperson.firstname',
|
{
|
||||||
language: null,
|
language: null,
|
||||||
value: 'User'
|
value: 'User'
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
key: 'eperson.lastname',
|
'eperson.lastname': [
|
||||||
language: null,
|
{
|
||||||
value: 'Test'
|
language: null,
|
||||||
},
|
value: 'Test'
|
||||||
{
|
}
|
||||||
key: 'eperson.language',
|
],
|
||||||
language: null,
|
'eperson.language': [
|
||||||
value: 'en'
|
{
|
||||||
}
|
language: null,
|
||||||
],
|
value: 'en'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
name: 'User Test',
|
name: 'User Test',
|
||||||
netid: 'myself@testshib.org',
|
netid: 'myself@testshib.org',
|
||||||
requireCertificate: false,
|
requireCertificate: false,
|
||||||
|
@@ -219,44 +219,44 @@ describe('BrowseService', () => {
|
|||||||
}}));
|
}}));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the URL for the given metadatumKey and linkPath', () => {
|
it('should return the URL for the given metadataKey and linkPath', () => {
|
||||||
const metadatumKey = 'dc.date.issued';
|
const metadataKey = 'dc.date.issued';
|
||||||
const linkPath = 'items';
|
const linkPath = 'items';
|
||||||
const expectedURL = browseDefinitions[0]._links[linkPath];
|
const expectedURL = browseDefinitions[0]._links[linkPath];
|
||||||
|
|
||||||
const result = service.getBrowseURLFor(metadatumKey, linkPath);
|
const result = service.getBrowseURLFor(metadataKey, linkPath);
|
||||||
const expected = cold('c-d-', { c: undefined, d: expectedURL });
|
const expected = cold('c-d-', { c: undefined, d: expectedURL });
|
||||||
|
|
||||||
expect(result).toBeObservable(expected);
|
expect(result).toBeObservable(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should work when the definition uses a wildcard in the metadatumKey', () => {
|
it('should work when the definition uses a wildcard in the metadataKey', () => {
|
||||||
const metadatumKey = 'dc.contributor.author'; // should match dc.contributor.* in the definition
|
const metadataKey = 'dc.contributor.author'; // should match dc.contributor.* in the definition
|
||||||
const linkPath = 'items';
|
const linkPath = 'items';
|
||||||
const expectedURL = browseDefinitions[1]._links[linkPath];
|
const expectedURL = browseDefinitions[1]._links[linkPath];
|
||||||
|
|
||||||
const result = service.getBrowseURLFor(metadatumKey, linkPath);
|
const result = service.getBrowseURLFor(metadataKey, linkPath);
|
||||||
const expected = cold('c-d-', { c: undefined, d: expectedURL });
|
const expected = cold('c-d-', { c: undefined, d: expectedURL });
|
||||||
|
|
||||||
expect(result).toBeObservable(expected);
|
expect(result).toBeObservable(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error when the key doesn\'t match', () => {
|
it('should throw an error when the key doesn\'t match', () => {
|
||||||
const metadatumKey = 'dc.title'; // isn't in the definitions
|
const metadataKey = 'dc.title'; // isn't in the definitions
|
||||||
const linkPath = 'items';
|
const linkPath = 'items';
|
||||||
|
|
||||||
const result = service.getBrowseURLFor(metadatumKey, linkPath);
|
const result = service.getBrowseURLFor(metadataKey, linkPath);
|
||||||
const expected = cold('c-#-', { c: undefined }, new Error(`A browse endpoint for ${linkPath} on ${metadatumKey} isn't configured`));
|
const expected = cold('c-#-', { c: undefined }, new Error(`A browse endpoint for ${linkPath} on ${metadataKey} isn't configured`));
|
||||||
|
|
||||||
expect(result).toBeObservable(expected);
|
expect(result).toBeObservable(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error when the link doesn\'t match', () => {
|
it('should throw an error when the link doesn\'t match', () => {
|
||||||
const metadatumKey = 'dc.date.issued';
|
const metadataKey = 'dc.date.issued';
|
||||||
const linkPath = 'collections'; // isn't in the definitions
|
const linkPath = 'collections'; // isn't in the definitions
|
||||||
|
|
||||||
const result = service.getBrowseURLFor(metadatumKey, linkPath);
|
const result = service.getBrowseURLFor(metadataKey, linkPath);
|
||||||
const expected = cold('c-#-', { c: undefined }, new Error(`A browse endpoint for ${linkPath} on ${metadatumKey} isn't configured`));
|
const expected = cold('c-#-', { c: undefined }, new Error(`A browse endpoint for ${linkPath} on ${metadataKey} isn't configured`));
|
||||||
|
|
||||||
expect(result).toBeObservable(expected);
|
expect(result).toBeObservable(expected);
|
||||||
});
|
});
|
||||||
@@ -271,10 +271,10 @@ describe('BrowseService', () => {
|
|||||||
spyOn(service, 'getBrowseDefinitions').and
|
spyOn(service, 'getBrowseDefinitions').and
|
||||||
.returnValue(hot('----'));
|
.returnValue(hot('----'));
|
||||||
|
|
||||||
const metadatumKey = 'dc.date.issued';
|
const metadataKey = 'dc.date.issued';
|
||||||
const linkPath = 'items';
|
const linkPath = 'items';
|
||||||
|
|
||||||
const result = service.getBrowseURLFor(metadatumKey, linkPath);
|
const result = service.getBrowseURLFor(metadataKey, linkPath);
|
||||||
const expected = cold('b---', { b: undefined });
|
const expected = cold('b---', { b: undefined });
|
||||||
expect(result).toBeObservable(expected);
|
expect(result).toBeObservable(expected);
|
||||||
});
|
});
|
||||||
|
@@ -8,20 +8,24 @@ import { of as observableOf } from 'rxjs';
|
|||||||
const pageInfo = new PageInfo();
|
const pageInfo = new PageInfo();
|
||||||
const array = [
|
const array = [
|
||||||
Object.assign(new Item(), {
|
Object.assign(new Item(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Item nr 1'
|
value: 'Item nr 1'
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
Object.assign(new Item(), {
|
Object.assign(new Item(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Item nr 2'
|
value: 'Item nr 2'
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
const paginatedList = new PaginatedList(pageInfo, array);
|
const paginatedList = new PaginatedList(pageInfo, array);
|
||||||
|
@@ -24,13 +24,14 @@ describe('BrowseItemsResponseParsingService', () => {
|
|||||||
uuid: 'd7b6bc6f-ff6c-444a-a0d3-0cd9b68043e7',
|
uuid: 'd7b6bc6f-ff6c-444a-a0d3-0cd9b68043e7',
|
||||||
name: 'Development of Local Supply Chain : A Critical Link for Concentrated Solar Power in India',
|
name: 'Development of Local Supply Chain : A Critical Link for Concentrated Solar Power in India',
|
||||||
handle: '10986/17472',
|
handle: '10986/17472',
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.creator': [
|
||||||
key: 'dc.creator',
|
{
|
||||||
value: 'World Bank',
|
value: 'World Bank',
|
||||||
language: null
|
language: null
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
|
},
|
||||||
inArchive: true,
|
inArchive: true,
|
||||||
discoverable: true,
|
discoverable: true,
|
||||||
withdrawn: false,
|
withdrawn: false,
|
||||||
@@ -56,13 +57,14 @@ describe('BrowseItemsResponseParsingService', () => {
|
|||||||
uuid: '27c6f976-257c-4ad0-a0ef-c5e34ffe4d5b',
|
uuid: '27c6f976-257c-4ad0-a0ef-c5e34ffe4d5b',
|
||||||
name: 'Development of Local Supply Chain : The Missing Link for Concentrated Solar Power Projects in India',
|
name: 'Development of Local Supply Chain : The Missing Link for Concentrated Solar Power Projects in India',
|
||||||
handle: '10986/17475',
|
handle: '10986/17475',
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.creator': [
|
||||||
key: 'dc.creator',
|
{
|
||||||
value: 'World Bank',
|
value: 'World Bank',
|
||||||
language: null
|
language: null
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
|
},
|
||||||
inArchive: true,
|
inArchive: true,
|
||||||
discoverable: true,
|
discoverable: true,
|
||||||
withdrawn: false,
|
withdrawn: false,
|
||||||
@@ -115,13 +117,14 @@ describe('BrowseItemsResponseParsingService', () => {
|
|||||||
uuid: 'd7b6bc6f-ff6c-444a-a0d3-0cd9b68043e7',
|
uuid: 'd7b6bc6f-ff6c-444a-a0d3-0cd9b68043e7',
|
||||||
name: 'Development of Local Supply Chain : A Critical Link for Concentrated Solar Power in India',
|
name: 'Development of Local Supply Chain : A Critical Link for Concentrated Solar Power in India',
|
||||||
handle: '10986/17472',
|
handle: '10986/17472',
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.creator': [
|
||||||
key: 'dc.creator',
|
{
|
||||||
value: 'World Bank',
|
value: 'World Bank',
|
||||||
language: null
|
language: null
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
|
},
|
||||||
inArchive: true,
|
inArchive: true,
|
||||||
discoverable: true,
|
discoverable: true,
|
||||||
withdrawn: false,
|
withdrawn: false,
|
||||||
|
@@ -37,6 +37,7 @@ import { HttpClient } from '@angular/common/http';
|
|||||||
import { EmptyError } from 'rxjs/internal-compatibility';
|
import { EmptyError } from 'rxjs/internal-compatibility';
|
||||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||||
import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service';
|
import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service';
|
||||||
|
import { MetadataValue } from '../shared/metadata.interfaces';
|
||||||
|
|
||||||
/* tslint:disable:max-classes-per-file */
|
/* tslint:disable:max-classes-per-file */
|
||||||
@Component({
|
@Component({
|
||||||
@@ -152,7 +153,7 @@ describe('MetadataService', () => {
|
|||||||
expect(title.getTitle()).toEqual('Test PowerPoint Document');
|
expect(title.getTitle()).toEqual('Test PowerPoint Document');
|
||||||
expect(tagStore.get('citation_title')[0].content).toEqual('Test PowerPoint Document');
|
expect(tagStore.get('citation_title')[0].content).toEqual('Test PowerPoint Document');
|
||||||
expect(tagStore.get('citation_author')[0].content).toEqual('Doe, Jane');
|
expect(tagStore.get('citation_author')[0].content).toEqual('Doe, Jane');
|
||||||
expect(tagStore.get('citation_date')[0].content).toEqual('1650-06-26T19:58:25Z');
|
expect(tagStore.get('citation_date')[0].content).toEqual('1650-06-26');
|
||||||
expect(tagStore.get('citation_issn')[0].content).toEqual('123456789');
|
expect(tagStore.get('citation_issn')[0].content).toEqual('123456789');
|
||||||
expect(tagStore.get('citation_language')[0].content).toEqual('en');
|
expect(tagStore.get('citation_language')[0].content).toEqual('en');
|
||||||
expect(tagStore.get('citation_keywords')[0].content).toEqual('keyword1; keyword2; keyword3');
|
expect(tagStore.get('citation_keywords')[0].content).toEqual('keyword1; keyword2; keyword3');
|
||||||
@@ -216,22 +217,18 @@ describe('MetadataService', () => {
|
|||||||
|
|
||||||
const mockType = (mockItem: Item, type: string): Item => {
|
const mockType = (mockItem: Item, type: string): Item => {
|
||||||
const typedMockItem = Object.assign(new Item(), mockItem) as Item;
|
const typedMockItem = Object.assign(new Item(), mockItem) as Item;
|
||||||
for (const metadatum of typedMockItem.metadata) {
|
typedMockItem.metadata['dc.type'] = [ { value: type } ] as MetadataValue[];
|
||||||
if (metadatum.key === 'dc.type') {
|
|
||||||
metadatum.value = type;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return typedMockItem;
|
return typedMockItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
const mockPublisher = (mockItem: Item): Item => {
|
const mockPublisher = (mockItem: Item): Item => {
|
||||||
const publishedMockItem = Object.assign(new Item(), mockItem) as Item;
|
const publishedMockItem = Object.assign(new Item(), mockItem) as Item;
|
||||||
publishedMockItem.metadata.push({
|
publishedMockItem.metadata['dc.publisher'] = [
|
||||||
key: 'dc.publisher',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Mock Publisher'
|
value: 'Mock Publisher'
|
||||||
});
|
}
|
||||||
|
] as MetadataValue[];
|
||||||
return publishedMockItem;
|
return publishedMockItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,7 +11,6 @@ import { ResourceType } from '../../../core/shared/resource-type';
|
|||||||
import { ComColFormComponent } from './comcol-form.component';
|
import { ComColFormComponent } from './comcol-form.component';
|
||||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||||
import { hasValue } from '../../empty.util';
|
import { hasValue } from '../../empty.util';
|
||||||
import { Metadatum } from '../../../core/shared/metadatum.model';
|
|
||||||
|
|
||||||
describe('ComColFormComponent', () => {
|
describe('ComColFormComponent', () => {
|
||||||
let comp: ComColFormComponent<DSpaceObject>;
|
let comp: ComColFormComponent<DSpaceObject>;
|
||||||
@@ -29,23 +28,24 @@ describe('ComColFormComponent', () => {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const titleMD = { key: 'dc.title', value: 'Community Title' } as Metadatum;
|
const dcTitle = 'dc.title';
|
||||||
const randomMD = { key: 'dc.random', value: 'Random metadata excluded from form' } as Metadatum;
|
const dcRandom = 'dc.random';
|
||||||
const abstractMD = {
|
const dcAbstract = 'dc.description.abstract';
|
||||||
key: 'dc.description.abstract',
|
|
||||||
value: 'Community description'
|
const titleMD = { [dcTitle]: [ { value: 'Community Title', language: null } ] };
|
||||||
} as Metadatum;
|
const randomMD = { [dcRandom]: [ { value: 'Random metadata excluded from form', language: null } ] };
|
||||||
const newTitleMD = { key: 'dc.title', value: 'New Community Title' } as Metadatum;
|
const abstractMD = { [dcAbstract]: [ { value: 'Community description', language: null } ] };
|
||||||
|
const newTitleMD = { [dcTitle]: [ { value: 'New Community Title', language: null } ] };
|
||||||
const formModel = [
|
const formModel = [
|
||||||
new DynamicInputModel({
|
new DynamicInputModel({
|
||||||
id: 'title',
|
id: 'title',
|
||||||
name: newTitleMD.key,
|
name: dcTitle,
|
||||||
value: 'New Community Title'
|
value: newTitleMD[dcTitle][0].value
|
||||||
}),
|
}),
|
||||||
new DynamicInputModel({
|
new DynamicInputModel({
|
||||||
id: 'abstract',
|
id: 'abstract',
|
||||||
name: abstractMD.key,
|
name: dcAbstract,
|
||||||
value: abstractMD.value
|
value: abstractMD[dcAbstract][0].value
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -87,10 +87,10 @@ describe('ComColFormComponent', () => {
|
|||||||
comp.dso = Object.assign(
|
comp.dso = Object.assign(
|
||||||
new Community(),
|
new Community(),
|
||||||
{
|
{
|
||||||
metadata: [
|
metadata: {
|
||||||
titleMD,
|
...titleMD,
|
||||||
randomMD
|
...randomMD
|
||||||
]
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -101,11 +101,11 @@ describe('ComColFormComponent', () => {
|
|||||||
{},
|
{},
|
||||||
new Community(),
|
new Community(),
|
||||||
{
|
{
|
||||||
metadata: [
|
metadata: {
|
||||||
randomMD,
|
...newTitleMD,
|
||||||
newTitleMD,
|
...randomMD,
|
||||||
abstractMD
|
...abstractMD
|
||||||
],
|
},
|
||||||
type: ResourceType.Community
|
type: ResourceType.Community
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@@ -51,13 +51,14 @@ export const MockItem: Item = Object.assign(new Item(), {
|
|||||||
id: 'cf9b0c8e-a1eb-4b65-afd0-567366448713',
|
id: 'cf9b0c8e-a1eb-4b65-afd0-567366448713',
|
||||||
uuid: 'cf9b0c8e-a1eb-4b65-afd0-567366448713',
|
uuid: 'cf9b0c8e-a1eb-4b65-afd0-567366448713',
|
||||||
type: 'bitstream',
|
type: 'bitstream',
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{
|
||||||
language: null,
|
language: null,
|
||||||
value: 'test_word.docx'
|
value: 'test_word.docx'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sizeBytes: 31302,
|
sizeBytes: 31302,
|
||||||
@@ -85,13 +86,14 @@ export const MockItem: Item = Object.assign(new Item(), {
|
|||||||
id: '99b00f3c-1cc6-4689-8158-91965bee6b28',
|
id: '99b00f3c-1cc6-4689-8158-91965bee6b28',
|
||||||
uuid: '99b00f3c-1cc6-4689-8158-91965bee6b28',
|
uuid: '99b00f3c-1cc6-4689-8158-91965bee6b28',
|
||||||
type: 'bitstream',
|
type: 'bitstream',
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{
|
||||||
language: null,
|
language: null,
|
||||||
value: 'test_pdf.pdf'
|
value: 'test_pdf.pdf'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -100,98 +102,106 @@ export const MockItem: Item = Object.assign(new Item(), {
|
|||||||
id: '0ec7ff22-f211-40ab-a69e-c819b0b1f357',
|
id: '0ec7ff22-f211-40ab-a69e-c819b0b1f357',
|
||||||
uuid: '0ec7ff22-f211-40ab-a69e-c819b0b1f357',
|
uuid: '0ec7ff22-f211-40ab-a69e-c819b0b1f357',
|
||||||
type: 'item',
|
type: 'item',
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.creator': [
|
||||||
key: 'dc.creator',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Doe, Jane'
|
value: 'Doe, Jane'
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
key: 'dc.date.accessioned',
|
'dc.date.accessioned': [
|
||||||
language: null,
|
{
|
||||||
value: '1650-06-26T19:58:25Z'
|
language: null,
|
||||||
},
|
value: '1650-06-26T19:58:25Z'
|
||||||
{
|
}
|
||||||
key: 'dc.date.available',
|
],
|
||||||
language: null,
|
'dc.date.available': [
|
||||||
value: '1650-06-26T19:58:25Z'
|
{
|
||||||
},
|
language: null,
|
||||||
{
|
value: '1650-06-26T19:58:25Z'
|
||||||
key: 'dc.date.issued',
|
}
|
||||||
language: null,
|
],
|
||||||
value: '1650-06-26'
|
'dc.date.issued': [
|
||||||
},
|
{
|
||||||
{
|
language: null,
|
||||||
key: 'dc.identifier.issn',
|
value: '1650-06-26'
|
||||||
language: 'en_US',
|
}
|
||||||
value: '123456789'
|
],
|
||||||
},
|
'dc.identifier.issn': [
|
||||||
{
|
{
|
||||||
key: 'dc.identifier.uri',
|
language: 'en_US',
|
||||||
language: null,
|
value: '123456789'
|
||||||
value: 'http://dspace7.4science.it/xmlui/handle/10673/6'
|
}
|
||||||
},
|
],
|
||||||
{
|
'dc.identifier.uri': [
|
||||||
key: 'dc.description.abstract',
|
{
|
||||||
language: 'en_US',
|
language: null,
|
||||||
value: 'This is really just a sample abstract. If it was a real abstract it would contain useful information about this test document. Sorry though, nothing useful in this paragraph. You probably shouldn\'t have even bothered to read it!'
|
value: 'http://dspace7.4science.it/xmlui/handle/10673/6'
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
key: 'dc.description.provenance',
|
'dc.description.abstract': [
|
||||||
language: 'en',
|
{
|
||||||
value: 'Made available in DSpace on 2012-06-26T19:58:25Z (GMT). No. of bitstreams: 2\r\ntest_ppt.ppt: 12707328 bytes, checksum: a353fc7d29b3c558c986f7463a41efd3 (MD5)\r\ntest_ppt.pptx: 12468572 bytes, checksum: 599305edb4ebee329667f2c35b14d1d6 (MD5)'
|
language: 'en_US',
|
||||||
},
|
value: 'This is really just a sample abstract. If it was a real abstract it would contain useful information about this test document. Sorry though, nothing useful in this paragraph. You probably shouldn\'t have even bothered to read it!'
|
||||||
{
|
}
|
||||||
key: 'dc.description.provenance',
|
],
|
||||||
language: 'en',
|
'dc.description.provenance': [
|
||||||
value: 'Restored into DSpace on 2013-06-13T09:17:34Z (GMT).'
|
{
|
||||||
},
|
language: 'en',
|
||||||
{
|
value: 'Made available in DSpace on 2012-06-26T19:58:25Z (GMT). No. of bitstreams: 2\r\ntest_ppt.ppt: 12707328 bytes, checksum: a353fc7d29b3c558c986f7463a41efd3 (MD5)\r\ntest_ppt.pptx: 12468572 bytes, checksum: 599305edb4ebee329667f2c35b14d1d6 (MD5)'
|
||||||
key: 'dc.description.provenance',
|
},
|
||||||
language: 'en',
|
{
|
||||||
value: 'Restored into DSpace on 2013-06-13T11:04:16Z (GMT).'
|
language: 'en',
|
||||||
},
|
value: 'Restored into DSpace on 2013-06-13T09:17:34Z (GMT).'
|
||||||
{
|
},
|
||||||
key: 'dc.description.provenance',
|
{
|
||||||
language: 'en',
|
language: 'en',
|
||||||
value: 'Restored into DSpace on 2017-04-24T19:44:08Z (GMT).'
|
value: 'Restored into DSpace on 2013-06-13T11:04:16Z (GMT).'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'dc.language',
|
language: 'en',
|
||||||
language: 'en_US',
|
value: 'Restored into DSpace on 2017-04-24T19:44:08Z (GMT).'
|
||||||
value: 'en'
|
}
|
||||||
},
|
],
|
||||||
{
|
'dc.language': [
|
||||||
key: 'dc.rights',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: '© Jane Doe'
|
value: 'en'
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
key: 'dc.subject',
|
'dc.rights': [
|
||||||
language: 'en_US',
|
{
|
||||||
value: 'keyword1'
|
language: 'en_US',
|
||||||
},
|
value: '© Jane Doe'
|
||||||
{
|
}
|
||||||
key: 'dc.subject',
|
],
|
||||||
language: 'en_US',
|
'dc.subject': [
|
||||||
value: 'keyword2'
|
{
|
||||||
},
|
language: 'en_US',
|
||||||
{
|
value: 'keyword1'
|
||||||
key: 'dc.subject',
|
},
|
||||||
language: 'en_US',
|
{
|
||||||
value: 'keyword3'
|
language: 'en_US',
|
||||||
},
|
value: 'keyword2'
|
||||||
{
|
},
|
||||||
key: 'dc.title',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Test PowerPoint Document'
|
value: 'keyword3'
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
key: 'dc.type',
|
'dc.title': [
|
||||||
language: 'en_US',
|
{
|
||||||
value: 'text'
|
language: 'en_US',
|
||||||
}
|
value: 'Test PowerPoint Document'
|
||||||
],
|
}
|
||||||
|
],
|
||||||
|
'dc.type': [
|
||||||
|
{
|
||||||
|
language: 'en_US',
|
||||||
|
value: 'text'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
owningCollection: observableOf({
|
owningCollection: observableOf({
|
||||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb',
|
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb',
|
||||||
requestPending: false,
|
requestPending: false,
|
||||||
|
@@ -8,21 +8,25 @@ let collectionGridElementComponent: CollectionGridElementComponent;
|
|||||||
let fixture: ComponentFixture<CollectionGridElementComponent>;
|
let fixture: ComponentFixture<CollectionGridElementComponent>;
|
||||||
|
|
||||||
const mockCollectionWithAbstract: Collection = Object.assign(new Collection(), {
|
const mockCollectionWithAbstract: Collection = Object.assign(new Collection(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.description.abstract': [
|
||||||
key: 'dc.description.abstract',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Short description'
|
value: 'Short description'
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const mockCollectionWithoutAbstract: Collection = Object.assign(new Collection(), {
|
const mockCollectionWithoutAbstract: Collection = Object.assign(new Collection(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Test title'
|
value: 'Test title'
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('CollectionGridElementComponent', () => {
|
describe('CollectionGridElementComponent', () => {
|
||||||
|
@@ -8,21 +8,25 @@ let communityGridElementComponent: CommunityGridElementComponent;
|
|||||||
let fixture: ComponentFixture<CommunityGridElementComponent>;
|
let fixture: ComponentFixture<CommunityGridElementComponent>;
|
||||||
|
|
||||||
const mockCommunityWithAbstract: Community = Object.assign(new Community(), {
|
const mockCommunityWithAbstract: Community = Object.assign(new Community(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.description.abstract': [
|
||||||
key: 'dc.description.abstract',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Short description'
|
value: 'Short description'
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const mockCommunityWithoutAbstract: Community = Object.assign(new Community(), {
|
const mockCommunityWithoutAbstract: Community = Object.assign(new Community(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Test title'
|
value: 'Test title'
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('CommunityGridElementComponent', () => {
|
describe('CommunityGridElementComponent', () => {
|
||||||
|
@@ -11,31 +11,37 @@ let fixture: ComponentFixture<ItemGridElementComponent>;
|
|||||||
|
|
||||||
const mockItemWithAuthorAndDate: Item = Object.assign(new Item(), {
|
const mockItemWithAuthorAndDate: Item = Object.assign(new Item(), {
|
||||||
bitstreams: observableOf({}),
|
bitstreams: observableOf({}),
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.contributor.author': [
|
||||||
key: 'dc.contributor.author',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Smith, Donald'
|
value: 'Smith, Donald'
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
key: 'dc.date.issued',
|
'dc.date.issued': [
|
||||||
language: null,
|
{
|
||||||
value: '2015-06-26'
|
language: null,
|
||||||
}]
|
value: '2015-06-26'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
const mockItemWithoutAuthorAndDate: Item = Object.assign(new Item(), {
|
const mockItemWithoutAuthorAndDate: Item = Object.assign(new Item(), {
|
||||||
bitstreams: observableOf({}),
|
bitstreams: observableOf({}),
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'This is just another title'
|
value: 'This is just another title'
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
key: 'dc.type',
|
'dc.type': [
|
||||||
language: null,
|
{
|
||||||
value: 'Article'
|
language: null,
|
||||||
}]
|
value: 'Article'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('ItemGridElementComponent', () => {
|
describe('ItemGridElementComponent', () => {
|
||||||
|
@@ -16,25 +16,29 @@ const truncatableServiceStub: any = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const mockCollectionWithAbstract: CollectionSearchResult = new CollectionSearchResult();
|
const mockCollectionWithAbstract: CollectionSearchResult = new CollectionSearchResult();
|
||||||
mockCollectionWithAbstract.hitHighlights = [];
|
mockCollectionWithAbstract.hitHighlights = {};
|
||||||
mockCollectionWithAbstract.dspaceObject = Object.assign(new Collection(), {
|
mockCollectionWithAbstract.dspaceObject = Object.assign(new Collection(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.description.abstract': [
|
||||||
key: 'dc.description.abstract',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Short description'
|
value: 'Short description'
|
||||||
} ]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const mockCollectionWithoutAbstract: CollectionSearchResult = new CollectionSearchResult();
|
const mockCollectionWithoutAbstract: CollectionSearchResult = new CollectionSearchResult();
|
||||||
mockCollectionWithoutAbstract.hitHighlights = [];
|
mockCollectionWithoutAbstract.hitHighlights = {};
|
||||||
mockCollectionWithoutAbstract.dspaceObject = Object.assign(new Collection(), {
|
mockCollectionWithoutAbstract.dspaceObject = Object.assign(new Collection(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Test title'
|
value: 'Test title'
|
||||||
} ]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('CollectionSearchResultGridElementComponent', () => {
|
describe('CollectionSearchResultGridElementComponent', () => {
|
||||||
|
@@ -16,25 +16,29 @@ const truncatableServiceStub: any = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const mockCommunityWithAbstract: CommunitySearchResult = new CommunitySearchResult();
|
const mockCommunityWithAbstract: CommunitySearchResult = new CommunitySearchResult();
|
||||||
mockCommunityWithAbstract.hitHighlights = [];
|
mockCommunityWithAbstract.hitHighlights = {};
|
||||||
mockCommunityWithAbstract.dspaceObject = Object.assign(new Community(), {
|
mockCommunityWithAbstract.dspaceObject = Object.assign(new Community(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.description.abstract': [
|
||||||
key: 'dc.description.abstract',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Short description'
|
value: 'Short description'
|
||||||
} ]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const mockCommunityWithoutAbstract: CommunitySearchResult = new CommunitySearchResult();
|
const mockCommunityWithoutAbstract: CommunitySearchResult = new CommunitySearchResult();
|
||||||
mockCommunityWithoutAbstract.hitHighlights = [];
|
mockCommunityWithoutAbstract.hitHighlights = {};
|
||||||
mockCommunityWithoutAbstract.dspaceObject = Object.assign(new Community(), {
|
mockCommunityWithoutAbstract.dspaceObject = Object.assign(new Community(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Test title'
|
value: 'Test title'
|
||||||
} ]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('CommunitySearchResultGridElementComponent', () => {
|
describe('CommunitySearchResultGridElementComponent', () => {
|
||||||
|
@@ -17,37 +17,43 @@ const truncatableServiceStub: any = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const mockItemWithAuthorAndDate: ItemSearchResult = new ItemSearchResult();
|
const mockItemWithAuthorAndDate: ItemSearchResult = new ItemSearchResult();
|
||||||
mockItemWithAuthorAndDate.hitHighlights = [];
|
mockItemWithAuthorAndDate.hitHighlights = {};
|
||||||
mockItemWithAuthorAndDate.dspaceObject = Object.assign(new Item(), {
|
mockItemWithAuthorAndDate.dspaceObject = Object.assign(new Item(), {
|
||||||
bitstreams: observableOf({}),
|
bitstreams: observableOf({}),
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.contributor.author': [
|
||||||
key: 'dc.contributor.author',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Smith, Donald'
|
value: 'Smith, Donald'
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
key: 'dc.date.issued',
|
'dc.date.issued': [
|
||||||
language: null,
|
{
|
||||||
value: '2015-06-26'
|
language: null,
|
||||||
}]
|
value: '2015-06-26'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const mockItemWithoutAuthorAndDate: ItemSearchResult = new ItemSearchResult();
|
const mockItemWithoutAuthorAndDate: ItemSearchResult = new ItemSearchResult();
|
||||||
mockItemWithoutAuthorAndDate.hitHighlights = [];
|
mockItemWithoutAuthorAndDate.hitHighlights = {};
|
||||||
mockItemWithoutAuthorAndDate.dspaceObject = Object.assign(new Item(), {
|
mockItemWithoutAuthorAndDate.dspaceObject = Object.assign(new Item(), {
|
||||||
bitstreams: observableOf({}),
|
bitstreams: observableOf({}),
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'This is just another title'
|
value: 'This is just another title'
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
key: 'dc.type',
|
'dc.type': [
|
||||||
language: null,
|
{
|
||||||
value: 'Article'
|
language: null,
|
||||||
}]
|
value: 'Article'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('ItemSearchResultGridElementComponent', () => {
|
describe('ItemSearchResultGridElementComponent', () => {
|
||||||
|
@@ -2,7 +2,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|||||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { TruncatePipe } from '../../utils/truncate.pipe';
|
import { TruncatePipe } from '../../utils/truncate.pipe';
|
||||||
import { Metadatum } from '../../../core/shared/metadatum.model';
|
|
||||||
import { BrowseEntryListElementComponent } from './browse-entry-list-element.component';
|
import { BrowseEntryListElementComponent } from './browse-entry-list-element.component';
|
||||||
import { BrowseEntry } from '../../../core/shared/browse-entry.model';
|
import { BrowseEntry } from '../../../core/shared/browse-entry.model';
|
||||||
|
|
||||||
@@ -33,7 +32,7 @@ describe('MetadataListElementComponent', () => {
|
|||||||
browseEntryListElementComponent = fixture.componentInstance;
|
browseEntryListElementComponent = fixture.componentInstance;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('When the metadatum is loaded', () => {
|
describe('When the metadata is loaded', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
browseEntryListElementComponent.object = mockValue;
|
browseEntryListElementComponent.object = mockValue;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@@ -8,21 +8,25 @@ let collectionListElementComponent: CollectionListElementComponent;
|
|||||||
let fixture: ComponentFixture<CollectionListElementComponent>;
|
let fixture: ComponentFixture<CollectionListElementComponent>;
|
||||||
|
|
||||||
const mockCollectionWithAbstract: Collection = Object.assign(new Collection(), {
|
const mockCollectionWithAbstract: Collection = Object.assign(new Collection(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.description.abstract': [
|
||||||
key: 'dc.description.abstract',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Short description'
|
value: 'Short description'
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const mockCollectionWithoutAbstract: Collection = Object.assign(new Collection(), {
|
const mockCollectionWithoutAbstract: Collection = Object.assign(new Collection(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Test title'
|
value: 'Test title'
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('CollectionListElementComponent', () => {
|
describe('CollectionListElementComponent', () => {
|
||||||
|
@@ -8,21 +8,25 @@ let communityListElementComponent: CommunityListElementComponent;
|
|||||||
let fixture: ComponentFixture<CommunityListElementComponent>;
|
let fixture: ComponentFixture<CommunityListElementComponent>;
|
||||||
|
|
||||||
const mockCommunityWithAbstract: Community = Object.assign(new Community(), {
|
const mockCommunityWithAbstract: Community = Object.assign(new Community(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.description.abstract': [
|
||||||
key: 'dc.description.abstract',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Short description'
|
value: 'Short description'
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const mockCommunityWithoutAbstract: Community = Object.assign(new Community(), {
|
const mockCommunityWithoutAbstract: Community = Object.assign(new Community(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Test title'
|
value: 'Test title'
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('CommunityListElementComponent', () => {
|
describe('CommunityListElementComponent', () => {
|
||||||
|
@@ -11,31 +11,37 @@ let fixture: ComponentFixture<ItemListElementComponent>;
|
|||||||
|
|
||||||
const mockItemWithAuthorAndDate: Item = Object.assign(new Item(), {
|
const mockItemWithAuthorAndDate: Item = Object.assign(new Item(), {
|
||||||
bitstreams: observableOf({}),
|
bitstreams: observableOf({}),
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.contributor.author': [
|
||||||
key: 'dc.contributor.author',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Smith, Donald'
|
value: 'Smith, Donald'
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
key: 'dc.date.issued',
|
'dc.date.issued': [
|
||||||
language: null,
|
{
|
||||||
value: '2015-06-26'
|
language: null,
|
||||||
}]
|
value: '2015-06-26'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
const mockItemWithoutAuthorAndDate: Item = Object.assign(new Item(), {
|
const mockItemWithoutAuthorAndDate: Item = Object.assign(new Item(), {
|
||||||
bitstreams: observableOf({}),
|
bitstreams: observableOf({}),
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'This is just another title'
|
value: 'This is just another title'
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
key: 'dc.type',
|
'dc.type': [
|
||||||
language: null,
|
{
|
||||||
value: 'Article'
|
language: null,
|
||||||
}]
|
value: 'Article'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('ItemListElementComponent', () => {
|
describe('ItemListElementComponent', () => {
|
||||||
|
@@ -16,25 +16,29 @@ const truncatableServiceStub: any = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const mockCollectionWithAbstract: CollectionSearchResult = new CollectionSearchResult();
|
const mockCollectionWithAbstract: CollectionSearchResult = new CollectionSearchResult();
|
||||||
mockCollectionWithAbstract.hitHighlights = [];
|
mockCollectionWithAbstract.hitHighlights = {};
|
||||||
mockCollectionWithAbstract.dspaceObject = Object.assign(new Collection(), {
|
mockCollectionWithAbstract.dspaceObject = Object.assign(new Collection(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.description.abstract': [
|
||||||
key: 'dc.description.abstract',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Short description'
|
value: 'Short description'
|
||||||
} ]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const mockCollectionWithoutAbstract: CollectionSearchResult = new CollectionSearchResult();
|
const mockCollectionWithoutAbstract: CollectionSearchResult = new CollectionSearchResult();
|
||||||
mockCollectionWithoutAbstract.hitHighlights = [];
|
mockCollectionWithoutAbstract.hitHighlights = {};
|
||||||
mockCollectionWithoutAbstract.dspaceObject = Object.assign(new Collection(), {
|
mockCollectionWithoutAbstract.dspaceObject = Object.assign(new Collection(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Test title'
|
value: 'Test title'
|
||||||
} ]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('CollectionSearchResultListElementComponent', () => {
|
describe('CollectionSearchResultListElementComponent', () => {
|
||||||
|
@@ -16,25 +16,29 @@ const truncatableServiceStub: any = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const mockCommunityWithAbstract: CommunitySearchResult = new CommunitySearchResult();
|
const mockCommunityWithAbstract: CommunitySearchResult = new CommunitySearchResult();
|
||||||
mockCommunityWithAbstract.hitHighlights = [];
|
mockCommunityWithAbstract.hitHighlights = {};
|
||||||
mockCommunityWithAbstract.dspaceObject = Object.assign(new Community(), {
|
mockCommunityWithAbstract.dspaceObject = Object.assign(new Community(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.description.abstract': [
|
||||||
key: 'dc.description.abstract',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Short description'
|
value: 'Short description'
|
||||||
} ]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const mockCommunityWithoutAbstract: CommunitySearchResult = new CommunitySearchResult();
|
const mockCommunityWithoutAbstract: CommunitySearchResult = new CommunitySearchResult();
|
||||||
mockCommunityWithoutAbstract.hitHighlights = [];
|
mockCommunityWithoutAbstract.hitHighlights = {};
|
||||||
mockCommunityWithoutAbstract.dspaceObject = Object.assign(new Community(), {
|
mockCommunityWithoutAbstract.dspaceObject = Object.assign(new Community(), {
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Test title'
|
value: 'Test title'
|
||||||
} ]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('CommunitySearchResultListElementComponent', () => {
|
describe('CommunitySearchResultListElementComponent', () => {
|
||||||
|
@@ -17,37 +17,43 @@ const truncatableServiceStub: any = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const mockItemWithAuthorAndDate: ItemSearchResult = new ItemSearchResult();
|
const mockItemWithAuthorAndDate: ItemSearchResult = new ItemSearchResult();
|
||||||
mockItemWithAuthorAndDate.hitHighlights = [];
|
mockItemWithAuthorAndDate.hitHighlights = {};
|
||||||
mockItemWithAuthorAndDate.dspaceObject = Object.assign(new Item(), {
|
mockItemWithAuthorAndDate.dspaceObject = Object.assign(new Item(), {
|
||||||
bitstreams: observableOf({}),
|
bitstreams: observableOf({}),
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.contributor.author': [
|
||||||
key: 'dc.contributor.author',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'Smith, Donald'
|
value: 'Smith, Donald'
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
key: 'dc.date.issued',
|
'dc.date.issued': [
|
||||||
language: null,
|
{
|
||||||
value: '2015-06-26'
|
language: null,
|
||||||
}]
|
value: '2015-06-26'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const mockItemWithoutAuthorAndDate: ItemSearchResult = new ItemSearchResult();
|
const mockItemWithoutAuthorAndDate: ItemSearchResult = new ItemSearchResult();
|
||||||
mockItemWithoutAuthorAndDate.hitHighlights = [];
|
mockItemWithoutAuthorAndDate.hitHighlights = {};
|
||||||
mockItemWithoutAuthorAndDate.dspaceObject = Object.assign(new Item(), {
|
mockItemWithoutAuthorAndDate.dspaceObject = Object.assign(new Item(), {
|
||||||
bitstreams: observableOf({}),
|
bitstreams: observableOf({}),
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.title': [
|
||||||
key: 'dc.title',
|
{
|
||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: 'This is just another title'
|
value: 'This is just another title'
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
key: 'dc.type',
|
'dc.type': [
|
||||||
language: null,
|
{
|
||||||
value: 'Article'
|
language: null,
|
||||||
}]
|
value: 'Article'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('ItemSearchResultListElementComponent', () => {
|
describe('ItemSearchResultListElementComponent', () => {
|
||||||
|
@@ -30,6 +30,7 @@ describe('SearchFormComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should display scopes when available with default and all scopes', () => {
|
it('should display scopes when available with default and all scopes', () => {
|
||||||
|
|
||||||
comp.scopes = objects;
|
comp.scopes = objects;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const select: HTMLElement = de.query(By.css('select')).nativeElement;
|
const select: HTMLElement = de.query(By.css('select')).nativeElement;
|
||||||
@@ -121,33 +122,38 @@ export const objects: DSpaceObject[] = [
|
|||||||
id: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
id: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
||||||
uuid: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
uuid: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
||||||
type: ResourceType.Community,
|
type: ResourceType.Community,
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.description': [
|
||||||
key: 'dc.description',
|
{
|
||||||
language: null,
|
language: null,
|
||||||
value: ''
|
value: ''
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
key: 'dc.description.abstract',
|
'dc.description.abstract': [
|
||||||
language: null,
|
{
|
||||||
value: 'This is a test community to hold content for the OR2017 demostration'
|
language: null,
|
||||||
},
|
value: 'This is a test community to hold content for the OR2017 demostration'
|
||||||
{
|
}
|
||||||
key: 'dc.description.tableofcontents',
|
],
|
||||||
language: null,
|
'dc.description.tableofcontents': [
|
||||||
value: ''
|
{
|
||||||
},
|
language: null,
|
||||||
{
|
value: ''
|
||||||
key: 'dc.rights',
|
}
|
||||||
language: null,
|
],
|
||||||
value: ''
|
'dc.rights': [
|
||||||
},
|
{
|
||||||
{
|
language: null,
|
||||||
key: 'dc.title',
|
value: ''
|
||||||
language: null,
|
}
|
||||||
value: 'OR2017 - Demonstration'
|
],
|
||||||
}
|
'dc.title': [
|
||||||
]
|
{
|
||||||
|
language: null,
|
||||||
|
value: 'OR2017 - Demonstration'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
Object.assign(new Community(),
|
Object.assign(new Community(),
|
||||||
{
|
{
|
||||||
@@ -170,33 +176,38 @@ export const objects: DSpaceObject[] = [
|
|||||||
id: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
id: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||||
uuid: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
uuid: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||||
type: ResourceType.Community,
|
type: ResourceType.Community,
|
||||||
metadata: [
|
metadata: {
|
||||||
{
|
'dc.description': [
|
||||||
key: 'dc.description',
|
{
|
||||||
language: null,
|
language: null,
|
||||||
value: '<p>This is the introductory text for the <em>Sample Community</em> on the DSpace Demonstration Site. It is editable by System or Community Administrators (of this Community).</p>\r\n<p><strong>DSpace Communities may contain one or more Sub-Communities or Collections (of Items).</strong></p>\r\n<p>This particular Community has its own logo (the <a href=\'http://www.duraspace.org/\'>DuraSpace</a> logo).</p>'
|
value: '<p>This is the introductory text for the <em>Sample Community</em> on the DSpace Demonstration Site. It is editable by System or Community Administrators (of this Community).</p>\r\n<p><strong>DSpace Communities may contain one or more Sub-Communities or Collections (of Items).</strong></p>\r\n<p>This particular Community has its own logo (the <a href=\'http://www.duraspace.org/\'>DuraSpace</a> logo).</p>'
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
key: 'dc.description.abstract',
|
'dc.description.abstract': [
|
||||||
language: null,
|
{
|
||||||
value: 'This is a sample top-level community'
|
language: null,
|
||||||
},
|
value: 'This is a sample top-level community'
|
||||||
{
|
}
|
||||||
key: 'dc.description.tableofcontents',
|
],
|
||||||
language: null,
|
'dc.description.tableofcontents': [
|
||||||
value: '<p>This is the <em>news section</em> for this <em>Sample Community</em>. System or Community Administrators (of this Community) can edit this News field.</p>'
|
{
|
||||||
},
|
language: null,
|
||||||
{
|
value: '<p>This is the <em>news section</em> for this <em>Sample Community</em>. System or Community Administrators (of this Community) can edit this News field.</p>'
|
||||||
key: 'dc.rights',
|
}
|
||||||
language: null,
|
],
|
||||||
value: '<p><em>If this Community had special copyright text to display, it would be displayed here.</em></p>'
|
'dc.rights': [
|
||||||
},
|
{
|
||||||
{
|
language: null,
|
||||||
key: 'dc.title',
|
value: '<p><em>If this Community had special copyright text to display, it would be displayed here.</em></p>'
|
||||||
language: null,
|
}
|
||||||
value: 'Sample Community'
|
],
|
||||||
}
|
'dc.title': [
|
||||||
]
|
{
|
||||||
|
language: null,
|
||||||
|
value: 'Sample Community'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
|
Reference in New Issue
Block a user