From 37a8b9f25376cd36c229d067c3fef2e99e48cb3e Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Fri, 10 May 2019 14:06:23 +0200 Subject: [PATCH] 62339: ItemComponent test fixes --- .../item-types/shared/item.component.spec.ts | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/app/+item-page/simple/item-types/shared/item.component.spec.ts b/src/app/+item-page/simple/item-types/shared/item.component.spec.ts index a6b4dd801d..88b022fe6c 100644 --- a/src/app/+item-page/simple/item-types/shared/item.component.spec.ts +++ b/src/app/+item-page/simple/item-types/shared/item.component.spec.ts @@ -108,7 +108,7 @@ export function createRelationshipsObservable() { }) ]))); } -describe('ItemComponent', () => { +fdescribe('ItemComponent', () => { const arr1 = [ { id: 1, @@ -319,20 +319,31 @@ describe('ItemComponent', () => { let fixture: ComponentFixture; 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(), { id: '1', uuid: '1', - metadata: new MetadataMap(), - relationships: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), [ - Object.assign(new Relationship(), { - uuid: '123', - id: '123', - leftId: '1', - rightId: '2', - relationshipType: observableOf(new RemoteData(false, false, true, null, new RelationshipType())) - }) - ]))) + metadata: new MetadataMap() }); + mockItem.relationships = observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), [ + Object.assign(new Relationship(), { + uuid: '123', + id: '123', + leftItem: observableOf(new RemoteData(false, false, true, null, mockItem)), + rightItem: observableOf(new RemoteData(false, false, true, null, relatedItem)), + relationshipType: observableOf(new RemoteData(false, false, true, null, new RelationshipType())) + }) + ]))); mockItem.metadata[metadataField] = [ { value: 'Second value', @@ -353,17 +364,6 @@ describe('ItemComponent', () => { authority: '123' } ] 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({ findById: (id) => { if (id === relatedItem.id) { @@ -397,7 +397,7 @@ describe('ItemComponent', () => { fixture = TestBed.createComponent(ItemComponent); comp = fixture.componentInstance; fixture.detectChanges(); - representations = comp.buildRepresentations('bogus', metadataField, mockItemDataService); + representations = comp.buildRepresentations('bogus', metadataField); })); it('should contain exactly 4 metadata-representations', () => {