mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 06:53:03 +00:00
Failed attempt at fixing process-detail.component.spec.ts tests
This commit is contained in:
@@ -124,34 +124,5 @@ describe('ProcessDataService', () => {
|
||||
expect(processDataService.findById).toHaveBeenCalledTimes(1);
|
||||
expect(processDataService.invalidateByHref).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// /**
|
||||
// * Tests whether calls to `FindAllData` methods are correctly patched through in a concrete data service that implements it
|
||||
// */
|
||||
// export function testFindAllDataImplementation(serviceFactory: () => FindAllData<any>) {
|
||||
// let service;
|
||||
//
|
||||
// describe('FindAllData implementation', () => {
|
||||
// const OPTIONS = Object.assign(new FindListOptions(), { elementsPerPage: 10, currentPage: 3 });
|
||||
// const FOLLOWLINKS = [
|
||||
// followLink('test'),
|
||||
// followLink('something'),
|
||||
// ];
|
||||
//
|
||||
// beforeAll(() => {
|
||||
// service = serviceFactory();
|
||||
// (service as any).findAllData = jasmine.createSpyObj('findAllData', {
|
||||
// findAll: 'TEST findAll',
|
||||
// });
|
||||
// });
|
||||
//
|
||||
// it('should handle calls to findAll', () => {
|
||||
// const out: any = service.findAll(OPTIONS, false, true, ...FOLLOWLINKS);
|
||||
//
|
||||
// expect((service as any).findAllData.findAll).toHaveBeenCalledWith(OPTIONS, false, true, ...FOLLOWLINKS);
|
||||
// expect(out).toBe('TEST findAll');
|
||||
// });
|
||||
// });
|
||||
});
|
||||
|
@@ -106,10 +106,12 @@ describe('ProcessDetailComponent', () => {
|
||||
content: { href: 'log-selflink' }
|
||||
}
|
||||
});
|
||||
const processRD$ = createSuccessfulRemoteDataObject$(process);
|
||||
processService = jasmine.createSpyObj('processService', {
|
||||
getFiles: createSuccessfulRemoteDataObject$(createPaginatedList(files)),
|
||||
delete: createSuccessfulRemoteDataObject$(null),
|
||||
findById: createSuccessfulRemoteDataObject$(process),
|
||||
findById: processRD$,
|
||||
autoRefreshUntilCompletion: processRD$
|
||||
});
|
||||
bitstreamDataService = jasmine.createSpyObj('bitstreamDataService', {
|
||||
findByHref: createSuccessfulRemoteDataObject$(logBitstream)
|
||||
@@ -132,7 +134,7 @@ describe('ProcessDetailComponent', () => {
|
||||
});
|
||||
|
||||
route = jasmine.createSpyObj('route', {
|
||||
data: observableOf({ process: createSuccessfulRemoteDataObject(process) }),
|
||||
data: observableOf({ process: processRD$ }),
|
||||
snapshot: {
|
||||
params: { id: process.processId }
|
||||
}
|
||||
@@ -158,7 +160,8 @@ describe('ProcessDetailComponent', () => {
|
||||
{ provide: NotificationsService, useValue: notificationsService },
|
||||
{ provide: Router, useValue: router },
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
// schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
schemas: []
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
|
@@ -109,7 +109,10 @@ export class ProcessDetailComponent implements OnInit {
|
||||
this.processRD$ = this.route.data.pipe(
|
||||
switchMap((data) => {
|
||||
if (isPlatformBrowser(this.platformId)) {
|
||||
return this.processService.autoRefreshUntilCompletion(this.route.snapshot.params.id, 5000);
|
||||
const x = this.processService.autoRefreshUntilCompletion(this.route.snapshot.params.id, 5000);
|
||||
//[data.process as RemoteData<Process>];
|
||||
console.log("ASDF", x);
|
||||
return x;
|
||||
} else {
|
||||
return [data.process as RemoteData<Process>];
|
||||
}
|
||||
@@ -117,6 +120,7 @@ export class ProcessDetailComponent implements OnInit {
|
||||
redirectOn4xx(this.router, this.authService),
|
||||
);
|
||||
|
||||
this.processRD$.subscribe(x => console.log("QWER", x));
|
||||
this.isRefreshing$ = this.processRD$.pipe(
|
||||
find((processRD: RemoteData<Process>) => this.processService.hasCompletedOrFailed(processRD.payload)),
|
||||
map(() => false),
|
||||
|
Reference in New Issue
Block a user