Skip to content

Commit

Permalink
Merge branch 'DSpace:main' into issue/2145
Browse files Browse the repository at this point in the history
  • Loading branch information
hugo-escire authored Aug 13, 2023
2 parents 25479e1 + 77e994d commit 539edfa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
13 changes: 9 additions & 4 deletions src/app/process-page/detail/process-detail.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ describe('ProcessDetailComponent', () => {
providers: [
{
provide: ActivatedRoute,
useValue: { data: observableOf({ process: createSuccessfulRemoteDataObject(process) }) }
useValue: { data: observableOf({ process: createSuccessfulRemoteDataObject(process) }), snapshot: { params: { id: 1 } } },
},
{ provide: ProcessDataService, useValue: processService },
{ provide: BitstreamDataService, useValue: bitstreamDataService },
Expand Down Expand Up @@ -310,10 +310,11 @@ describe('ProcessDetailComponent', () => {
});

it('should call refresh method every 5 seconds, until process is completed', fakeAsync(() => {
spyOn(component, 'refresh');
spyOn(component, 'stopRefreshTimer');
spyOn(component, 'refresh').and.callThrough();
spyOn(component, 'stopRefreshTimer').and.callThrough();

process.processStatus = ProcessStatus.COMPLETED;
// start off with a running process in order for the refresh counter starts counting up
process.processStatus = ProcessStatus.RUNNING;
// set findbyId to return a completed process
(processService.findById as jasmine.Spy).and.returnValue(observableOf(createSuccessfulRemoteDataObject(process)));

Expand All @@ -336,6 +337,10 @@ describe('ProcessDetailComponent', () => {
tick(1001); // 1 second + 1 ms by the setTimeout
expect(component.refreshCounter$.value).toBe(0); // 1 - 1

// set the process to completed right before the counter checks the process
process.processStatus = ProcessStatus.COMPLETED;
(processService.findById as jasmine.Spy).and.returnValue(observableOf(createSuccessfulRemoteDataObject(process)));

tick(1000); // 1 second

expect(component.refresh).toHaveBeenCalledTimes(1);
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11743,9 +11743,9 @@ wildcard@^2.0.0:
integrity sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==

word-wrap@^1.2.3, word-wrap@~1.2.3:
version "1.2.3"
resolved "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz"
integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==
version "1.2.5"
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34"
integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==

wrap-ansi@^6.2.0:
version "6.2.0"
Expand Down

0 comments on commit 539edfa

Please sign in to comment.