Skip to content

Commit a9f04cc

Browse files
[DSC-2028] adapt findById in metadata link view, fix tests
1 parent 6f15379 commit a9f04cc

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/rendering-types/crisref/crisref.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('CrisrefComponent', () => {
2020
let fixture: ComponentFixture<CrisrefComponent>;
2121

2222
const itemService = jasmine.createSpyObj('ItemDataService', {
23-
findById: jasmine.createSpy('findById')
23+
findByIdWithProjections: jasmine.createSpy('findByIdWithProjections')
2424
});
2525
const metadataValue = Object.assign(new MetadataValue(), {
2626
'value': 'test item title',
@@ -106,7 +106,7 @@ describe('CrisrefComponent', () => {
106106
beforeEach(() => {
107107
fixture = TestBed.createComponent(CrisrefComponent);
108108
component = fixture.componentInstance;
109-
itemService.findById.and.returnValue(createSuccessfulRemoteDataObject$(testPerson));
109+
itemService.findByIdWithProjections.and.returnValue(createSuccessfulRemoteDataObject$(testPerson));
110110
fixture.detectChanges();
111111
});
112112

src/app/shared/metadata-link-view/metadata-link-view.component.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ describe('MetadataLinkViewComponent', () => {
9090
});
9191

9292
itemService = jasmine.createSpyObj('ItemDataService', {
93-
findById: jasmine.createSpy('findById')
93+
findByIdWithProjections: jasmine.createSpy('findByIdWithProjections')
9494
});
9595

9696
beforeEach(waitForAsync(() => {
@@ -110,7 +110,7 @@ describe('MetadataLinkViewComponent', () => {
110110
describe('Check metadata without authority', () => {
111111
beforeEach(() => {
112112
fixture = TestBed.createComponent(MetadataLinkViewComponent);
113-
itemService.findById.and.returnValue(createSuccessfulRemoteDataObject$(testOrgunit));
113+
itemService.findByIdWithProjections.and.returnValue(createSuccessfulRemoteDataObject$(testOrgunit));
114114
component = fixture.componentInstance;
115115
component.item = testPerson;
116116
component.metadata = testMetadataValueWithoutAuthority;
@@ -135,7 +135,7 @@ describe('MetadataLinkViewComponent', () => {
135135
describe('when item is found with orcid', () => {
136136
beforeEach(() => {
137137
fixture = TestBed.createComponent(MetadataLinkViewComponent);
138-
itemService.findById.and.returnValue(createSuccessfulRemoteDataObject$(testPerson));
138+
itemService.findByIdWithProjections.and.returnValue(createSuccessfulRemoteDataObject$(testPerson));
139139
component = fixture.componentInstance;
140140
component.item = testPerson;
141141
component.metadata = testMetadataValueWithAuthority;
@@ -162,7 +162,7 @@ describe('MetadataLinkViewComponent', () => {
162162
describe('when item is found without orcid', () => {
163163
beforeEach(() => {
164164
fixture = TestBed.createComponent(MetadataLinkViewComponent);
165-
itemService.findById.and.returnValue(createSuccessfulRemoteDataObject$(testOrgunit));
165+
itemService.findByIdWithProjections.and.returnValue(createSuccessfulRemoteDataObject$(testOrgunit));
166166
component = fixture.componentInstance;
167167
component.item = testPerson;
168168
component.metadata = testMetadataValueWithAuthority;
@@ -189,7 +189,7 @@ describe('MetadataLinkViewComponent', () => {
189189
describe('when item is not found', () => {
190190
beforeEach(() => {
191191
fixture = TestBed.createComponent(MetadataLinkViewComponent);
192-
itemService.findById.and.returnValue(createFailedRemoteDataObject$());
192+
itemService.findByIdWithProjections.and.returnValue(createFailedRemoteDataObject$());
193193
component = fixture.componentInstance;
194194
component.item = testPerson;
195195
component.metadata = testMetadataValueWithAuthority;

src/app/shared/metadata-link-view/metadata-link-view.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class MetadataLinkViewComponent implements OnInit {
8585
const linksToFollow = [followLink('thumbnail')];
8686

8787
if (Metadata.hasValidAuthority(metadataValue.authority)) {
88-
return this.itemService.findById(metadataValue.authority, true, false, ...linksToFollow).pipe(
88+
return this.itemService.findByIdWithProjections(metadataValue.authority, ['preventMetadataSecurity'], true, false, ...linksToFollow).pipe(
8989
getFirstCompletedRemoteData(),
9090
map((itemRD: RemoteData<Item>) => this.createMetadataView(itemRD, metadataValue))
9191
);

0 commit comments

Comments
 (0)