Skip to content

Commit fbc817f

Browse files
Simone-Ramundiatarix83
authored andcommitted
Merged in DSC-1482 (pull request DSpace#1467)
[DSC-1482] Approved-by: Giuseppe Digilio
2 parents 5fd3e79 + 7e030e6 commit fbc817f

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/app/item-page/full/field-components/file-section/full-file-section.component.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { APP_CONFIG } from 'src/config/app-config.interface';
2222
import { environment } from 'src/environments/environment';
2323
import { UUIDService } from '../../../../core/shared/uuid.service';
2424
import { getMockUUIDService } from '../../../../shared/mocks/uuid.service.mock';
25+
import { Item } from '../../../../core/shared/item.model';
2526
import { AuthorizationDataService } from '../../../../core/data/feature-authorization/authorization-data.service';
2627

2728
describe('FullFileSectionComponent', () => {
@@ -56,7 +57,7 @@ describe('FullFileSectionComponent', () => {
5657
});
5758

5859
const bitstreamDataService = jasmine.createSpyObj('bitstreamDataService', {
59-
findAllByItemAndBundleName: createSuccessfulRemoteDataObject$(createPaginatedList([mockBitstream, mockBitstream, mockBitstream]))
60+
showableByItem: createSuccessfulRemoteDataObject$(createPaginatedList([mockBitstream, mockBitstream, mockBitstream])),
6061
});
6162

6263
const authorizedDataService = jasmine.createSpyObj('authorizedDataService',{
@@ -91,6 +92,7 @@ describe('FullFileSectionComponent', () => {
9192
beforeEach(waitForAsync(() => {
9293
fixture = TestBed.createComponent(FullFileSectionComponent);
9394
comp = fixture.componentInstance;
95+
comp.item = new Item();
9496
fixture.detectChanges();
9597
}));
9698

@@ -109,6 +111,7 @@ describe('FullFileSectionComponent', () => {
109111
authorizedDataService.isAuthorized.and.returnValue(observableOf(false));
110112
comp.canDownload(mockBitstream).subscribe(canDownload => expect(canDownload).toBeFalse());
111113
}));
114+
112115
it('canDownload should return an observable with true value, if user is authorized to download bitstream', waitForAsync(() => {
113116
authorizedDataService.isAuthorized.and.returnValue(observableOf(true));
114117
comp.canDownload(mockBitstream).subscribe(canDownload => expect(canDownload).toBeTrue());

src/app/item-page/full/field-components/file-section/full-file-section.component.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ export class FullFileSectionComponent extends FileSectionComponent implements On
7070

7171
initialize(): void {
7272
this.originals$ = this.paginationService.getCurrentPagination(this.originalOptions.id, this.originalOptions).pipe(
73-
switchMap((options: PaginationComponentOptions) => this.bitstreamDataService.findAllByItemAndBundleName(
74-
this.item,
73+
switchMap((options: PaginationComponentOptions) => this.bitstreamDataService.showableByItem(
74+
this.item.uuid,
7575
'ORIGINAL',
76+
[],
7677
{elementsPerPage: options.pageSize, currentPage: options.currentPage},
7778
true,
7879
true,
@@ -88,9 +89,10 @@ export class FullFileSectionComponent extends FileSectionComponent implements On
8889
);
8990

9091
this.licenses$ = this.paginationService.getCurrentPagination(this.licenseOptions.id, this.licenseOptions).pipe(
91-
switchMap((options: PaginationComponentOptions) => this.bitstreamDataService.findAllByItemAndBundleName(
92-
this.item,
92+
switchMap((options: PaginationComponentOptions) => this.bitstreamDataService.showableByItem(
93+
this.item.uuid,
9394
'LICENSE',
95+
[],
9496
{elementsPerPage: options.pageSize, currentPage: options.currentPage},
9597
true,
9698
true,

0 commit comments

Comments
 (0)