From 5700450eec178dc60a4f3105535adfde1df242db Mon Sep 17 00:00:00 2001 From: Alessandro Martelli Date: Tue, 22 Dec 2020 18:20:22 +0100 Subject: [PATCH] [CSTPER-3620] Workflow Actions refresh entire MyDSpace page instead of just WorkflowItem Failing tests in CI environment refactored --- ...med-task-actions-approve.component.spec.ts | 22 +++++++++++-------- ...imed-task-actions-reject.component.spec.ts | 11 +++++----- 2 files changed, 18 insertions(+), 15 deletions(-) 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(); + }); }); });