mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 21:13:07 +00:00
update tests
This commit is contained in:

committed by
Andreas Awouters

parent
960bfbbfe5
commit
f887997fb3
@@ -15,18 +15,20 @@ import { VarDirective } from '../../../shared/utils/var.directive';
|
|||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { AuthService } from '../../../core/auth/auth.service';
|
import { AuthService } from '../../../core/auth/auth.service';
|
||||||
import { AuthServiceMock } from '../../../shared/mocks/auth.service.mock';
|
import { AuthServiceMock } from '../../../shared/mocks/auth.service.mock';
|
||||||
import { RouteService } from '../../../core/services/route.service';
|
import { RouteService } from '../../../core/services/route.service';
|
||||||
import { routeServiceStub } from '../../../shared/testing/route-service.stub';
|
import { routeServiceStub } from '../../../shared/testing/route-service.stub';
|
||||||
|
import { ProcessOverviewService } from '../process-overview.service';
|
||||||
|
import { take } from 'rxjs/operators';
|
||||||
|
|
||||||
|
|
||||||
describe('ProcessOverviewTableComponent', () => {
|
describe('ProcessOverviewTableComponent', () => {
|
||||||
let component: ProcessOverviewTableComponent;
|
let component: ProcessOverviewTableComponent;
|
||||||
let fixture: ComponentFixture<ProcessOverviewTableComponent>;
|
let fixture: ComponentFixture<ProcessOverviewTableComponent>;
|
||||||
|
|
||||||
|
let processOverviewService: ProcessOverviewService;
|
||||||
let processService: ProcessDataService;
|
let processService: ProcessDataService;
|
||||||
let ePersonService: EPersonDataService;
|
let ePersonService: EPersonDataService;
|
||||||
let paginationService; // : PaginationService; Not typed as the stub does not fully implement PaginationService
|
let paginationService; // : PaginationService; Not typed as the stub does not fully implement PaginationService
|
||||||
@@ -78,8 +80,16 @@ describe('ProcessOverviewTableComponent', () => {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
processOverviewService = jasmine.createSpyObj('processOverviewService', {
|
||||||
|
getFindListOptions: {
|
||||||
|
currentPage: 1,
|
||||||
|
elementsPerPage: 5,
|
||||||
|
sort: 'creationTime'
|
||||||
|
},
|
||||||
|
getProcessesByProcessStatus: createSuccessfulRemoteDataObject$(createPaginatedList(processes)).pipe(take(1))
|
||||||
|
});
|
||||||
processService = jasmine.createSpyObj('processService', {
|
processService = jasmine.createSpyObj('processService', {
|
||||||
searchBy: createSuccessfulRemoteDataObject$(createPaginatedList(processes))
|
searchBy: createSuccessfulRemoteDataObject$(createPaginatedList(processes)).pipe(take(1))
|
||||||
});
|
});
|
||||||
ePersonService = jasmine.createSpyObj('ePersonService', {
|
ePersonService = jasmine.createSpyObj('ePersonService', {
|
||||||
findById: createSuccessfulRemoteDataObject$(ePerson)
|
findById: createSuccessfulRemoteDataObject$(ePerson)
|
||||||
@@ -117,6 +127,7 @@ describe('ProcessOverviewTableComponent', () => {
|
|||||||
declarations: [ProcessOverviewTableComponent, VarDirective, NgbCollapse],
|
declarations: [ProcessOverviewTableComponent, VarDirective, NgbCollapse],
|
||||||
imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([])],
|
imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([])],
|
||||||
providers: [
|
providers: [
|
||||||
|
{ provide: ProcessOverviewService, useValue: processOverviewService },
|
||||||
{ provide: ProcessDataService, useValue: processService },
|
{ provide: ProcessDataService, useValue: processService },
|
||||||
{ provide: EPersonDataService, useValue: ePersonService },
|
{ provide: EPersonDataService, useValue: ePersonService },
|
||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
@@ -125,7 +136,6 @@ describe('ProcessOverviewTableComponent', () => {
|
|||||||
{ provide: AuthService, useValue: authService },
|
{ provide: AuthService, useValue: authService },
|
||||||
{ provide: RouteService, useValue: routeService },
|
{ provide: RouteService, useValue: routeService },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@@ -196,7 +196,9 @@ export class ProcessOverviewTableComponent implements OnInit, OnDestroy {
|
|||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
).subscribe(this.processesRD$));
|
).subscribe((next: RemoteData<PaginatedList<ProcessOverviewTableEntry>>) => {
|
||||||
|
this.processesRD$.next(next);
|
||||||
|
}));
|
||||||
|
|
||||||
// Collapse this section when the number of processes is zero the first time processes are retrieved
|
// Collapse this section when the number of processes is zero the first time processes are retrieved
|
||||||
this.subs.push(this.processesRD$.pipe(
|
this.subs.push(this.processesRD$.pipe(
|
||||||
|
Reference in New Issue
Block a user