diff --git a/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.spec.ts b/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.spec.ts index afcc01c315..c3db0f71d7 100644 --- a/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.spec.ts +++ b/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.spec.ts @@ -102,18 +102,22 @@ describe('ClaimedTaskActionsApproveComponent', () => { it('should start the action execution', () => { expect(component.startActionExecution).toHaveBeenCalled(); }); + }); - describe('actionExecution', () => { - beforeEach(() => { - component.actionExecution().subscribe(); - fixture.detectChanges(); + describe('actionExecution', () => { + + it('should call claimedTaskService\'s submitTask', (done) => { + + const expectedBody = { + [component.option]: 'true' + }; + + component.actionExecution().subscribe(() => { + expect(claimedTaskService.submitTask).toHaveBeenCalledWith(object.id, expectedBody); + done(); }); - - it('should call claimedTaskService\'s submitTask', () => { - expect(claimedTaskService.submitTask).toHaveBeenCalledWith(object.id, expectedBody) - }); - }); + }); describe('reloadObjectExecution', () => { diff --git a/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.spec.ts b/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.spec.ts index 8180db9f73..e0ab714d85 100644 --- a/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.spec.ts +++ b/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.spec.ts @@ -151,18 +151,17 @@ describe('ClaimedTaskActionsRejectComponent', () => { beforeEach(() => { spyOn((component.rejectForm as any), 'get').and.returnValue({value: 'required'}); - expectedBody = { [component.option]: 'true', reason: 'required' }; - - component.actionExecution().subscribe(); - fixture.detectChanges(); }); - it('should call claimedTaskService\'s submitTask with the proper reason', () => { - expect(claimedTaskService.submitTask).toHaveBeenCalledWith(object.id, expectedBody) + it('should call claimedTaskService\'s submitTask with the proper reason', (done) => { + component.actionExecution().subscribe(() => { + expect(claimedTaskService.submitTask).toHaveBeenCalledWith(object.id, expectedBody); + done(); + }); }); });