mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
62339: ItemComponent test fixes
This commit is contained in:
@@ -108,7 +108,7 @@ export function createRelationshipsObservable() {
|
|||||||
})
|
})
|
||||||
])));
|
])));
|
||||||
}
|
}
|
||||||
describe('ItemComponent', () => {
|
fdescribe('ItemComponent', () => {
|
||||||
const arr1 = [
|
const arr1 = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
@@ -319,20 +319,31 @@ describe('ItemComponent', () => {
|
|||||||
let fixture: ComponentFixture<ItemComponent>;
|
let fixture: ComponentFixture<ItemComponent>;
|
||||||
|
|
||||||
const metadataField = 'dc.contributor.author';
|
const metadataField = 'dc.contributor.author';
|
||||||
|
const relatedItem = Object.assign(new Item(), {
|
||||||
|
id: '2',
|
||||||
|
metadata: Object.assign(new MetadataMap(), {
|
||||||
|
'dc.title': [
|
||||||
|
{
|
||||||
|
language: 'en_US',
|
||||||
|
value: 'related item'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
});
|
||||||
const mockItem = Object.assign(new Item(), {
|
const mockItem = Object.assign(new Item(), {
|
||||||
id: '1',
|
id: '1',
|
||||||
uuid: '1',
|
uuid: '1',
|
||||||
metadata: new MetadataMap(),
|
metadata: new MetadataMap()
|
||||||
relationships: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), [
|
});
|
||||||
|
mockItem.relationships = observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), [
|
||||||
Object.assign(new Relationship(), {
|
Object.assign(new Relationship(), {
|
||||||
uuid: '123',
|
uuid: '123',
|
||||||
id: '123',
|
id: '123',
|
||||||
leftId: '1',
|
leftItem: observableOf(new RemoteData(false, false, true, null, mockItem)),
|
||||||
rightId: '2',
|
rightItem: observableOf(new RemoteData(false, false, true, null, relatedItem)),
|
||||||
relationshipType: observableOf(new RemoteData(false, false, true, null, new RelationshipType()))
|
relationshipType: observableOf(new RemoteData(false, false, true, null, new RelationshipType()))
|
||||||
})
|
})
|
||||||
])))
|
])));
|
||||||
});
|
|
||||||
mockItem.metadata[metadataField] = [
|
mockItem.metadata[metadataField] = [
|
||||||
{
|
{
|
||||||
value: 'Second value',
|
value: 'Second value',
|
||||||
@@ -353,17 +364,6 @@ describe('ItemComponent', () => {
|
|||||||
authority: '123'
|
authority: '123'
|
||||||
}
|
}
|
||||||
] as MetadataValue[];
|
] as MetadataValue[];
|
||||||
const relatedItem = Object.assign(new Item(), {
|
|
||||||
id: '2',
|
|
||||||
metadata: Object.assign(new MetadataMap(), {
|
|
||||||
'dc.title': [
|
|
||||||
{
|
|
||||||
language: 'en_US',
|
|
||||||
value: 'related item'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
});
|
|
||||||
const mockItemDataService = Object.assign({
|
const mockItemDataService = Object.assign({
|
||||||
findById: (id) => {
|
findById: (id) => {
|
||||||
if (id === relatedItem.id) {
|
if (id === relatedItem.id) {
|
||||||
@@ -397,7 +397,7 @@ describe('ItemComponent', () => {
|
|||||||
fixture = TestBed.createComponent(ItemComponent);
|
fixture = TestBed.createComponent(ItemComponent);
|
||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
representations = comp.buildRepresentations('bogus', metadataField, mockItemDataService);
|
representations = comp.buildRepresentations('bogus', metadataField);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should contain exactly 4 metadata-representations', () => {
|
it('should contain exactly 4 metadata-representations', () => {
|
||||||
|
Reference in New Issue
Block a user