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

@@ -11,10 +11,14 @@ const mockItem = Object.assign(new Item(), {
id: 'fake-id',
handle: 'fake/handle',
lastModified: '2018',
metadata: [
{key: 'dc.title', value: 'Mock item title', language: 'en'},
{key: 'dc.contributor.author', value: 'Mayer, Ed', language: ''}
]
metadata: {
'dc.title': [
{ value: 'Mock item title', language: 'en' }
],
'dc.contributor.author': [
{ value: 'Mayer, Ed', language: '' }
]
}
});
describe('ModifyItemOverviewComponent', () => {
@@ -37,19 +41,19 @@ describe('ModifyItemOverviewComponent', () => {
const metadataRows = fixture.debugElement.queryAll(By.css('tr.metadata-row'));
expect(metadataRows.length).toEqual(2);
const titleRow = 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'));
const authorRow = metadataRows[0].queryAll(By.css('td'));
expect(authorRow.length).toEqual(3);
expect(authorRow[0].nativeElement.innerHTML).toContain('dc.contributor.author');
expect(authorRow[1].nativeElement.innerHTML).toContain('Mayer, Ed');
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');
});
});