DS-4107 Update tests and mocks for metadata as map

This commit is contained in:
Chris Wilper
2018-12-22 23:05:57 -05:00
parent 2368df9513
commit ea9ce6194c
25 changed files with 646 additions and 551 deletions

View File

@@ -16,25 +16,29 @@ const truncatableServiceStub: any = {
};
const mockCollectionWithAbstract: CollectionSearchResult = new CollectionSearchResult();
mockCollectionWithAbstract.hitHighlights = [];
mockCollectionWithAbstract.hitHighlights = {};
mockCollectionWithAbstract.dspaceObject = Object.assign(new Collection(), {
metadata: [
{
key: 'dc.description.abstract',
language: 'en_US',
value: 'Short description'
} ]
metadata: {
'dc.description.abstract': [
{
language: 'en_US',
value: 'Short description'
}
]
}
});
const mockCollectionWithoutAbstract: CollectionSearchResult = new CollectionSearchResult();
mockCollectionWithoutAbstract.hitHighlights = [];
mockCollectionWithoutAbstract.hitHighlights = {};
mockCollectionWithoutAbstract.dspaceObject = Object.assign(new Collection(), {
metadata: [
{
key: 'dc.title',
language: 'en_US',
value: 'Test title'
} ]
metadata: {
'dc.title': [
{
language: 'en_US',
value: 'Test title'
}
]
}
});
describe('CollectionSearchResultGridElementComponent', () => {

View File

@@ -16,25 +16,29 @@ const truncatableServiceStub: any = {
};
const mockCommunityWithAbstract: CommunitySearchResult = new CommunitySearchResult();
mockCommunityWithAbstract.hitHighlights = [];
mockCommunityWithAbstract.hitHighlights = {};
mockCommunityWithAbstract.dspaceObject = Object.assign(new Community(), {
metadata: [
{
key: 'dc.description.abstract',
language: 'en_US',
value: 'Short description'
} ]
metadata: {
'dc.description.abstract': [
{
language: 'en_US',
value: 'Short description'
}
]
}
});
const mockCommunityWithoutAbstract: CommunitySearchResult = new CommunitySearchResult();
mockCommunityWithoutAbstract.hitHighlights = [];
mockCommunityWithoutAbstract.hitHighlights = {};
mockCommunityWithoutAbstract.dspaceObject = Object.assign(new Community(), {
metadata: [
{
key: 'dc.title',
language: 'en_US',
value: 'Test title'
} ]
metadata: {
'dc.title': [
{
language: 'en_US',
value: 'Test title'
}
]
}
});
describe('CommunitySearchResultGridElementComponent', () => {

View File

@@ -17,37 +17,43 @@ const truncatableServiceStub: any = {
};
const mockItemWithAuthorAndDate: ItemSearchResult = new ItemSearchResult();
mockItemWithAuthorAndDate.hitHighlights = [];
mockItemWithAuthorAndDate.hitHighlights = {};
mockItemWithAuthorAndDate.dspaceObject = Object.assign(new Item(), {
bitstreams: observableOf({}),
metadata: [
{
key: 'dc.contributor.author',
language: 'en_US',
value: 'Smith, Donald'
},
{
key: 'dc.date.issued',
language: null,
value: '2015-06-26'
}]
metadata: {
'dc.contributor.author': [
{
language: 'en_US',
value: 'Smith, Donald'
}
],
'dc.date.issued': [
{
language: null,
value: '2015-06-26'
}
]
}
});
const mockItemWithoutAuthorAndDate: ItemSearchResult = new ItemSearchResult();
mockItemWithoutAuthorAndDate.hitHighlights = [];
mockItemWithoutAuthorAndDate.hitHighlights = {};
mockItemWithoutAuthorAndDate.dspaceObject = Object.assign(new Item(), {
bitstreams: observableOf({}),
metadata: [
{
key: 'dc.title',
language: 'en_US',
value: 'This is just another title'
},
{
key: 'dc.type',
language: null,
value: 'Article'
}]
metadata: {
'dc.title': [
{
language: 'en_US',
value: 'This is just another title'
}
],
'dc.type': [
{
language: null,
value: 'Article'
}
]
}
});
describe('ItemSearchResultGridElementComponent', () => {